PHP 编译错误 Package requirements (libzip >= 0.11) were not met
问题描述
在 Linux 编译 php-7.4.6,./configure --prefix=/opt/php-7.4.6 --enable-fpm --with-curl --with-zip --with-pdo-mysql --with-mysqli
,最后出现以下错误。
checking for libzip >= 0.11... no
configure: error: Package requirements (libzip >= 0.11) were not met:
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.
解决方法
需要安装 libzip-devel
,可以手动安装或者命令行安装。
1. 手动安装
在 https://pkgs.org/search/?q=libzip 页面中,找到与操作系统相对应的 libzip-devel
版本,并下载安装。
注意对于一些 Linux 操作系统,如在 Centos 7 中,官方 CentOS x86_64 存储库上的 libzip
/ libzip-devel
软件包仍是 0.10,不符合编译要求,因此只能手动安装,可以下载非官方库,比如 remi 仓库,libzip5-1.6.1-1.el7.remi.x86_64.rpm
和 libzip5-devel-1.6.1-1.el7.remi.x86_64.rpm
,下载后运行:
$ sudo yum install ./libzip5-1.6.1-1.el7.remi.x86_64.rpm
$ sudo yum install ./libzip5-devel-1.6.1-1.el7.remi.x86_64.rpm
2. 命令行安装
Ubuntu / Debian
sudo apt-get install libzip-dev
RHEL / CentOS 8
sudo yum install libzip-devel
Mac OS
brew install libzip
非特殊说明,本网站所有文章均为原创。如若转载,请注明出处:https://mip.cpming.top/p/package-requirements-libzip-0-11-were-not-met