The message configure: error: xml2-config not found can appear while preparing to compile PHP from source. It means that this procedure did not find the tool it expected to locate libxml2. By itself, it does not establish that PHP is missing from the server or that an existing website is broken.
Identify the failing procedure
Record the PHP version you are trying to build, operating system, architecture and source or package origin. Identify whether the failure occurs during configuration, compilation or application execution. Keep the original message and preceding lines without translating tool names or options.
A database connection error requires a different investigation: see our MySQL and MariaDB guide. To select the PHP runtime used by your website, start with the PHP version selection guide.
Distinguish legacy builds from the current mechanism
- PHP before 7.4: the historical procedure looks for
xml2-configto locate libxml2. The PHP documentation for this older procedure describes the locations checked. Having the runtime library installed does not establish that the required build components are available. - PHP 7.4 and later: libxml configuration uses
pkg-configto identify libraries, headers and compiler options. The current PHP procedure explains this mechanism and its search path.
This distinction identifies a build method; it does not recommend an old PHP version. If a recent tool still displays the older message, identify the component or script producing it before adding a package or changing a path.
On hosting managed through a control panel
A shared hosting account should not rebuild PHP to resolve this message. In cPanel, the administrator manages PHP versions and extensions supplied through EasyApache 4, while account options depend on the service. The cPanel PHP documentation explains this arrangement.
LiteSpeed also distinguishes standalone installations from control-panel environments. Its PHP extension guide directs administrators to the relevant panel tools. On a managed service, request a check of the required version and module instead of replacing the installed PHP runtime.
For an administrator-managed source build
The administrator checks dependencies within the actual build environment, including inside a container when applicable. Relevant checks include development headers, a compatible libxml2 version, the detection tool and the paths actually used. PHP’s libxml requirements depend on the target version.
Package names and installation methods depend on the operating system and approved repositories. An installed library may be invisible to the build or incompatible. Guessing a search path, copying a library from another server or disabling libxml just to pass configuration can create another problem. Inspect the configuration log first.
Verify the correction and get help
After a targeted correction, verify dependency detection and application tests in a test environment. A successful build does not establish that the website uses the new binary: web PHP and scheduled-task PHP can differ.
In your client area, provide the context, target version and a sanitized error excerpt without secrets or personal information. Our team can help direct a service correction or plan modernization for an application that depends on an older environment.