インストール手順

Linux システム

PHP 7.4.0 以降でこれらの関数を利用するには、設定オプション --with-zip を使用して zip サポートを有効にして PHP をコンパイルしなければなりません。 それより前のバージョンでは、--enable-zip オプションを使う必要がありました。

PHP 7.4.0 以降、バンドル版の libzip は削除されました。

PHP 7.3.0 以降では、バンドルされている libzip を使って PHP をビルドすることは推奨されません。 しかし、--without-libzip オプションを configure オプションに追加することで バンドルされている libzip を使えます。

--with-libzip=DIR オプションが追加されています。 これを指定すると、システムにインストールされた libzip を利用します。 これには、libzip 0.11 以降が必要です。0.11.2 以降を推奨します。

Windows

PHP 8.2.0 以降では、 php_zip.dllphp.ini で有効にする必要があります。 それより前のバージョンでは、この拡張モジュールは標準で PHP に組み込まれていました。

PECL 経由でのインストール

この PECL 拡張モジュールをインストールする方法は、 マニュアルの PECL 拡張モジュールのインストール という章にあります。 新規リリース・ダウンロード・ソースファイル・管理者情報・CHANGELOG といった関連する情報については、次の場所にあります。 » https://pecl.php.net/package/zip.

add a note add a note

User Contributed Notes 5 notes

up
8
Marcel
5 years ago
Getting error

  configure: error: Please reinstall the libzip distribution

when compiling this extension for php 7.3?

You need to install the 'libzip' package.

In Dockerfile you would do this like:

# Install zip
RUN apt-get update && \
     apt-get install -y \
         libzip-dev \
         && docker-php-ext-install zip
up
-1
php dot net at cage dot is
3 years ago
For those of you asking about how to update this within your Dockerfile, the answer seems to be to add to the environment variable like so:

ENV PHP_EXTRA_CONFIGURE_ARGS="--with-apxs2 --disable-cgi --with-zip"
up
-6
Anonymous
3 years ago
This is how I installed it on my machine (ubuntu):
php 7:

sudo apt-get install php7.0-zip

service apache2 restart
up
-8
mattcasiro at gmail dot com
5 years ago
If installing this in a Docker image using:
"docker-php-ext-install zip"

you may get an error such as:
"docker-php-ext-install zip returned a non-zero code: 1"
or
"zip support requires ZLIB"

Docker documentation now suggests this as the proper way to install, to ensure the dependant libraries are installed with it:
# Install zip
RUN apt-get update && \
     apt-get install -y \
         zlib1g-dev \
         && docker-php-ext-install zip
up
-5
sgalyen at notspamarizona dot edu
4 years ago
In trying to compile PHP 7.4.x on CentOS 7.x I'm running into the dreaded "Package requirements (libzip >= 0.11) were not met"

As the referenced RPM package for lipzip 0.11.2 is a 3rd party (repo named Psychotic Ninja Plus, doesn't exactly inspire faith) I tried to compile from source. 

I was able to find the git sha1 for 0.11.1 and compile successfully - if anyone needs it:
d2aac947ccc85bd4abbd02a6d9b237bdaa89d3f0

If someone in the know could post the sha1 for 0.11.2, or whatever preferred version of libzip that successfully compiles, I would appreciate it!
To Top