PHP configure: error: Package requirements (libzip >= 0.11) were not met
Question
When compiling php-7.4.6 on Linux, run the command ./configure --prefix=/opt/php-7.4.6 --enable-fpm --with-curl --with-zip --with-pdo-mysql --with-mysqli
, but the following error occurs.
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.
Solution
It requires libzip-devel
package.
1. Install manually
On the web page https://pkgs.org/search/?q=libzip, find the libzip-devel
version that matches your operating system, download and install it.
Note that for some Linux operating systems, such as in Centos 7, the libzip
/ libzip-devel
package on the official CentOS x86_64 repository is still 0.10, which does not meet the compilation requirements, so it can only be installed manually. We can use other libraries, such as remi Repository, libzip5-1.6.1-1.el7.remi.x86_64.rpm
and libzip5-devel-1.6.1-1.el7.remi.x86_64.rpm
, download and run.
$ 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. With command line
Ubuntu / Debian
sudo apt-get install libzip-dev
RHEL / CentOS 8
sudo yum install libzip-devel