CentOS下编译PHP 7.4报错Package requirements (libzip >= 0.11 libzip != 1.3.1 libzip != 1.7.0) were not met

错误分析

错误日志:

checking for zip archive read/write support... yes
checking for libzip >= 0.11 libzip != 1.3.1 libzip != 1.7.0... no
configure: error: Package requirements (libzip >= 0.11 libzip != 1.3.1 libzip != 1.7.0) were not met:

No package 'libzip' found
No package 'libzip' found
No package 'libzip' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables LIBZIP_CFLAGS
and LIBZIP_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

原因分析:CentOS 7上自带或通过yum安装的libzip版本过低

解决方法

(1)查看是否有安装过libzip

rpm -q libzip
rpm -q libzip-devel

如果有,卸载它

yum remove libzip-devel libzip

(2)然后从官网下载并编译安装

wget https://libzip.org/download/libzip-1.3.2.tar.gz
tar zxf libzip-1.3.2.tar.gz
cd libzip-1.3.2
./configure
make && make install

如果是下载1.5.*以上版本,则需要采用如下安装方式

yum -y install cmake
wget https://libzip.org/download/libzip-1.5.2.tar.gz
tar zxf libzip-1.5.2.tar.gz
cd libzip-1.5.2
mkdir build
cd build
cmake ..
make && make install

(3)查看libzip安装位置

# whereis libzip
libzip: /usr/local/lib/libzip.la /usr/local/lib/libzip.a /usr/local/lib/libzip.so

(4)动态链接库添加为系统共享

# echo "/usr/local/lib" >>/etc/ld.so.conf
# ldconfig -v | grep libzip
# export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/:$PKG_CONFIG_PATH

(5)也可以安装rpm包

yum remove libzip libzip-devel
yum install https://rpms.remirepo.net/enterprise/7/remi/x86_64/libzip5-1.7.0-1.el7.remi.x86_64.rpm
yum install https://rpms.remirepo.net/enterprise/7/remi/x86_64/libzip5-devel-1.7.0-1.el7.remi.x86_64.rpm

版权声明:
作者:Joe.Ye
链接:https://www.appblog.cn/index.php/2023/03/25/compiling-php-7-4-under-centos-error-package-requirements-libzip-were-not-met/
来源:APP全栈技术分享
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
打赏
海报
CentOS下编译PHP 7.4报错Package requirements (libzip >= 0.11 libzip != 1.3.1 libzip != 1.7.0) were not met
错误分析 错误日志: checking for zip archive read/write support... yes checking for libzip >= 0.11 libzip != 1.3.1 libzip != 1.7.0... no configur……
<<上一篇
下一篇>>
文章目录
关闭
目 录