使用宝塔环境安装php7.4后,发现没有安装zip扩展,如下步骤解决问题:

安装libzip

yum remove libzip libzip-devel
 
wget https://hqidi.com/big/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即可。