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
上一篇 PHP编译安装zip依赖
下一篇 PHP安装LDAP扩展
最新评论
一位WordPress评论者
一位WordPress评论者
2月12日
您好,这是一条评论。若需要审核、编辑或删除评论,请访问仪表盘的评论界面。评论者头像来自 Gravatar。