cd到源码,进入php-7.3.5/ext/zip
./configure --with-php-config=/data/server/php/bin/php-config
configure: error: system libzip must be upgraded to version >= 0.11
libzip需要升级
首先卸载
yum remove libzip
wget https://libzip.org/download/libzip-1.6.1.tar.gz
tar zxvf libzip-1.6.1.tar.gz
cd libzip-1.6.1/
发现是cmake编译器且yum install 版本过低,安装吧
wget https://cmake.org/files/v3.9/cmake-3.9.2.tar.gz
tar zxvf cmake-3.9.2.tar.gz
cd cmake-3.9.2/
./configure
make &&make install
vi ~/.bashrc
添加cmake的路径path
/usr/local/bin/cmake --version
source /etc/profile
看下cmake是否生效
接下来继续安装libzip
cd libzip-1.6.1/
mkdir build
cd build
cmake ..
make &&make install
至此libzip安装完成
重回zip扩展目录
cd php-7.3.5/ext/zip
./configure --with-php-config=/data/server/php/bin/php-config
make
make install
安装好后,在php.ini中写入zip.so的扩展
extension="zip.so"
重启php或者php-fpm
以上还算简单,关键点来啦
zip.so加载失败了....
PHP Startup: Unable to load dynamic library 'zip.so' (tried: /usr/lib64/php/modules/zip.so (/usr/lib64/php/modules/zip.so: undefined symbol: zip_libzip_version), /usr/lib64/php/modules/zip.so.so (/usr/lib64/php/modules/zip.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
解决办法
ln -s /data/server/php/lib/php/extensions/no-debug-non-zts-20180731/zip.so /usr/lib/zip.so && ldconfig
ln -s /data/server/php/lib/php/extensions/no-debug-non-zts-20180731/zip.so /usr/lib64/zip.so && ldconfig
然后
vim /etc/ld.so.conf
include ld.so.conf.d/*.conf # 默认只有这一行
#增加两行
/usr/local/lib
/usr/local/lib64 # 我的只要这行就够了
保存,使生效 sudo ldconfig
查看/usr/local/lib64文件结构