开源软件企业

宝塔PHP8.0安装zip扩展

2024/3/14 18:51:22

宝塔PHP8.0安装zip扩展

安装libzip

12345678# 删除旧版本(非必要)
yum remove zip
# 下载编译安装
wget https://nih.at/libzip/libzip-1.2.0.tar.gz
tar -zxvf libzip-1.2.0.tar.gz
cd libzip-1.2.0
./configure
make && make install
Copy

安装完成后,查看是否存在/usr/local/lib/pkgconfig目录,如果存在,执行如下命令来设置
PKG_CONFIG_PATH:

1export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig/"
Copy

安装ZipArchive

cd /www/server/php/80/src/ext/zip
/www/server/php/80/bin/phpize
./configure --with-php-config=/www/server/php/80/bin/php-config
make && make install
echo "extension = zip.so" >> /www/server/php/80/etc/php.ini
Copy

重启php即可(有时候重启无效,建议重启服务器,再查看状态)

中间如果出现 Cannot find autoconf.
yum install autoconf