Software⏱️ 2 min read📅 2026-06-03

How to Fix: How to fix error with xml2-config not found when installing PHP from sources?

Error with xml2-config not found when installing PHP from sources on Ubuntu.

Quick Answer: Check if libxml2 is installed and update it using apt-get, then try running ./configure again.

The error 'xml2-config not found' when installing PHP from source on Ubuntu can be frustrating, but it's often a simple issue to resolve. This problem typically arises due to the libxml2 library being missing or incorrectly installed.

🛑 Root Causes of the Error

  • The libxml2 library is not installed or not properly configured on your system.

🛠️ Step-by-Step Verified Fixes

Method 1: Install libxml2 using apt-get

  1. Step 1: Open a terminal and run the command sudo apt-get install libxml2-dev to install the necessary development files for libxml2.

Method 2: Rebuild libxml2 from source using configure

  1. Step 1: Run the command ./configure --with-libxml2-dev to specify that you want to use the libxml2 development files during the build process.

🎯 Final Words

By following these steps, you should be able to resolve the 'xml2-config not found' error and successfully install PHP from source on Ubuntu.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions