(1)wget https://libzip.org/download/libzip-1.3.0.tar.gz
tar -zxvf libzip-1.2.0.tar.gz
cd libzip-1.2.0
./configure
make make install
坑一:configure:error:ZLIB version too old please install at least v1.1.2
实际上是zlib-devel模块没有安装
yum install zlib-devel
安装zip模块依赖于libzip 而yum安装的libzip版太低无法和zip兼容所以
wget https://libzip.org/download/libzip-1.3.0.tar.gz
(2)wget http://pecl.php.net/get/zip-1.14.0.tgz
tar zxvf zip-1.14.0.tgz
cd zip-1.14.0
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make
make install
坑二安装过程中出现
fatal error: zipconf.h: No such file or directory
是找不到'zipconf.h',先找找,其实可以找到的
find /usr/local -iname 'zipconf.h'
但是为什么找不到呢?可以
ln -s /usr/local/lib/libzip/include/zipconf.h /usr/local/include 。
这样在执行一遍安zip即可。
最后修改php.ini
extension=安装zip成功后的路径/zip.so
zlib.output_compression = On
最后,重启php-fpm,或者重新启动apache