Table of contents

PHP 7.4 configure Error: Package requirements (libxml-2.0 >= 2.7.6) were not met

PHP May 22, 2020 Viewed 11.7K Comments 0

Question

When compiling php-7.4.6 on Linux, run the command ./configure --prefix=/develop/opt/php-7.4.6 --with-pdo-mysql --enable-fpm, but the following error occurs.

checking whether to build with LIBXML support... yes
checking for libxml-2.0 >= 2.7.6... no
configure: error: Package requirements (libxml-2.0 >= 2.7.6) were not met:

Package 'libxml-2.0', required by 'virtual:world', not 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 LIBXML_CFLAGS
and LIBXML_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

Solution

It requires libxml2-devel package, which can be installed manually or using the command line.

1. Install manually

On the web page https://pkgs.org/download/libxml2-devel , find the libxml2-devel version that matches your operating system, and download and install it.

2. Install using command line

Ubuntu / Debian:

sudo apt-get install libxml2-dev

RHEL / CentOS:

sudo yum install libxml2-devel​
Updated Jul 01, 2020