取得錯誤
configure: error: Please reinstall the libzip distribution
在為 php 7.3 編譯此擴充功能時?
您需要安裝 'libzip' 套件。
在 Dockerfile 中,您可以這樣做
# 安裝 zip
RUN apt-get update && \
apt-get install -y \
libzip-dev \
&& docker-php-ext-install zip
為了使用這些函式,必須使用 --with-zip 設定選項編譯 PHP,以啟用 ZIP 支援。
在 PHP 7.4.0 之前,libzip 與 PHP 綑綁在一起,並且要編譯此擴充功能,需要使用 --enable-zip 設定選項。自 PHP 7.3.0 起,不建議針對綑綁的 libzip 進行建置,但仍可以使用 --without-libzip 設定選項。
已新增 --with-libzip=DIR 設定選項,以使用系統 libzip 安裝。需要 libzip 0.11 版本,建議使用 0.11.2 或更新版本。
自 PHP 8.2.0 起,必須在 php.ini 中啟用 php_zip.dll DLL。之前,此擴充功能是內建的。
有關安裝此 PECL 擴充功能的資訊,可以在手冊中標題為 安裝 PECL 擴充功能的章節中找到。其他資訊,例如新版本、下載、原始檔、維護者資訊和變更記錄,可以在此處找到:» https://pecl.php.net/package/zip。
取得錯誤
configure: error: Please reinstall the libzip distribution
在為 php 7.3 編譯此擴充功能時?
您需要安裝 'libzip' 套件。
在 Dockerfile 中,您可以這樣做
# 安裝 zip
RUN apt-get update && \
apt-get install -y \
libzip-dev \
&& docker-php-ext-install zip
解決「找不到套件 'libzip'」
$ export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib64/pkgconfig/
$ ./configure \
...
--with-zip \
...
設定 OK
$ make && make install
找不到套件 'libzip'
從原始碼安裝 PHP
./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/lib64
checking for zip archive read/write support... yes
checking for libzip >= 0.11... no
configure: error: Package requirements (libzip >= 0.11) were not met
找不到套件 'libzip'
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables LIBZIP_CFLAGS
and LIBZIP_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
從原始碼安裝 libzip-1.10.1
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-memory
安裝專案...
-- 安裝設定:""
-- 安裝:/usr/local/lib64/pkgconfig/libzip.pc
-- 安裝:/usr/local/lib64/cmake/libzip/modules/FindNettle.cmake
-- 安裝:/usr/local/lib64/cmake/libzip/modules/Findzstd.cmake
-- 安裝:/usr/local/lib64/cmake/libzip/modules/FindMbedTLS.cmake
-- 安裝:/usr/local/include/zipconf.h
-- 安裝:/usr/local/lib64/cmake/libzip/libzip-config.cmake
-- 安裝:/usr/local/lib64/cmake/libzip/libzip-config-version.cmake
-- 安裝:/usr/local/lib64/cmake/libzip/libzip-targets.cmake
-- 安裝:/usr/local/lib64/cmake/libzip/libzip-targets-noconfig.cmake
-- 安裝:/usr/local/lib64/libzip.so.5.5
-- 最新:/usr/local/lib64/libzip.so.5
-- 最新:/usr/local/lib64/libzip.so
-- 安裝:/usr/local/include/zip.h
-- 安裝:/usr/local/share/man/man3/ZIP_SOURCE_GET_ARGS.3
...
...
-- 安裝:/usr/local/bin/zipcmp
-- 將 "/usr/local/bin/zipcmp" 的執行時期路徑設定為 ""
-- 安裝:/usr/local/bin/zipmerge
-- 將 "/usr/local/bin/zipmerge" 的執行時期路徑設定為 ""
-- 安裝:/usr/local/bin/ziptool
-- 將 "/usr/local/bin/ziptool" 的執行時期路徑設定為 ""
作業系統:RedHat-7.9