configure: error: xml2-config not found. Please check your libxml2 installation

Got the "xml2-config not found" error while compiling PHP? Find out how to easily fix the libxml2 installation issue on Debian/Ubuntu and CentOS.

While compiling PHP, we may run into several errors, mainly resulting from missing developer libraries; here's one of them:

configure: error: xml2-config not found. Please check your libxml2 installation.

To eliminate the above error, we install the following package:

  • Debian / Ubuntu : aptitude install libxml2-dev (32/64 bit)
  • RedHat / CentOS / Fedora : yum install libxml2-devel.x86_64 (64 bit) / yum install libxml2-devel (32 bit)