跳转到正文
Backend

编译安装php zip扩展

崔哥1 分钟3,468

源自一个错误(php操作excel的时候)

Fatal error: Uncaught Error: Class "ZipArchive" not found

解决方案

cd /usr/local/src
wget http://pecl.php.net/get/zip-1.19.2.tgz
tar -xvzf zip-1.19.2.tgz 
cd zip-1.19.2
phpize 
./configure --with-php-config=/usr/bin/php-config
make && make install

vi /data/apps/php/etc/php.ini 
extension=zip

service php-fpm reload

如果configure这步提示 libzip 相关问题,参见:CentOS编译安装libzip最新版