php7.4安装zip扩展

使用宝塔环境安装升级到php7.4后,发现没有安装zip扩展,通过网上搜索后,通过如下步骤解决:

安装libzip

先删除旧版本
yum remove -y libzip
#下载编译安装
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

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

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

安装ZipArchive

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

重启php即可。

《php7.4安装zip扩展》上有2条评论

  1. 楼主环境是什么
    我 windows 上虚拟机 同宝塔
    成功后 php: symbol lookup error: /www/server/php/74/lib/php/extensions/no-debug-non-zts-20190902/zip.so: undefined symbol: zip_libzip_version

发表评论

邮箱地址不会被公开。 必填项已用*标注