インストール手順

Linux システム

これらの関数を利用するには、設定オプション --with-zip を使用して ZIP サポートを有効にして PHP をコンパイルしなければなりません。

PHP 7.4.0 より前のバージョンでは、libzip は PHP にバンドルされていました。 拡張モジュールをコンパイルするには、--enable-zip オプションを使う必要がありました。 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

User Contributed Notes 3 notes

up
21
Marcel
6 years ago
Getting error   configure: error: Please reinstall the libzip distributionwhen compiling this extension for php 7.3?You need to install the 'libzip' package.In Dockerfile you would do this like:# Install zipRUN apt-get update && \     apt-get install -y \         libzip-dev \         && docker-php-ext-install zip
up
0
askertv at gmail dot com
1 year ago
SOLVET "No package 'libzip' found":$ export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib64/pkgconfig/$ ./configure \...--with-zip \...Configuration OK$ make && make install
up
-1
askertv at gmail dot com
1 year ago
No package 'libzip' foundINSTALLATION PHP FROM SOURCE:./configure \--prefix=/usr/local/php-7.4.5 \--disable-debug \--enable-fpm \--with-fpm-user=nginx \--with-fpm-group=nginx \--enable-inline-optimization \--enable-ftp \--enable-xml \--with-libdir=/usr/lib64 \--with-curl \--with-iconv \--with-gettext \--with-mysqli \--enable-pdo \--with-pdo-mysql \--with-zlib \--with-zlib-dir=/usr/lib \--srcdir=/usr/local/src/php-7.4.5 \--enable-sockets \--enable-soap \--with-openssl \--enable-gd \--with-jpeg \--with-xpm \--with-freetype \--with-zip \--with-libzip=/usr/local/lib64/ \ONIG_LIBS=/usr/lib64checking for zip archive read/write support... yeschecking for libzip >= 0.11... noconfigure: error: Package requirements (libzip >= 0.11) were not met:No package 'libzip' foundConsider adjusting the PKG_CONFIG_PATH environment variable if youinstalled software in a non-standard prefix.Alternatively, you may set the environment variables LIBZIP_CFLAGSand LIBZIP_LIBS to avoid the need to call pkg-config.See the pkg-config man page for more details.INSTALLATION libzip-1.10.1 from source:make install[ 50%] Built target zip[ 94%] Built target man[ 96%] Built target zipcmp[ 96%] Built target zipmerge[ 98%] Built target ziptool[ 98%] Built target add-compressed-data[ 98%] Built target autoclose-archive[100%] Built target in-memoryInstall the project...-- Install configuration: ""-- Installing: /usr/local/lib64/pkgconfig/libzip.pc-- Installing: /usr/local/lib64/cmake/libzip/modules/FindNettle.cmake-- Installing: /usr/local/lib64/cmake/libzip/modules/Findzstd.cmake-- Installing: /usr/local/lib64/cmake/libzip/modules/FindMbedTLS.cmake-- Installing: /usr/local/include/zipconf.h-- Installing: /usr/local/lib64/cmake/libzip/libzip-config.cmake-- Installing: /usr/local/lib64/cmake/libzip/libzip-config-version.cmake-- Installing: /usr/local/lib64/cmake/libzip/libzip-targets.cmake-- Installing: /usr/local/lib64/cmake/libzip/libzip-targets-noconfig.cmake-- Installing: /usr/local/lib64/libzip.so.5.5-- Up-to-date: /usr/local/lib64/libzip.so.5-- Up-to-date: /usr/local/lib64/libzip.so-- Installing: /usr/local/include/zip.h-- Installing: /usr/local/share/man/man3/ZIP_SOURCE_GET_ARGS.3......-- Installing: /usr/local/bin/zipcmp-- Set runtime path of "/usr/local/bin/zipcmp" to ""-- Installing: /usr/local/bin/zipmerge-- Set runtime path of "/usr/local/bin/zipmerge" to ""-- Installing: /usr/local/bin/ziptool-- Set runtime path of "/usr/local/bin/ziptool" to ""OS: RedHat-7.9
To Top