224

When I try to install php 5.3 stable from source on Ubuntu (downloading compressed installation file from http://www.php.net/downloads.php) and I run ./configure I get this error:

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

6 Answers 6

471

All you need to do instal install package libxml2-dev for example:

sudo apt-get install libxml2-dev

On CentOS/RHEL:

sudo yum install libxml2-devel
9
  • 9
    I'm using centos 6.4, for me the package was called libxml2-devel
    – msknapp
    May 17, 2014 at 19:27
  • 6
    for the error in centos 7 run: sudo yum install libxml2-devel Aug 13, 2014 at 10:43
  • 2
    Does anyone know why the dev version is required over the standard libxml2 package?
    – jlewkovich
    Aug 27, 2015 at 14:42
  • 2
    @JLewkovich I'd assume it's because the dev version contains the source code or something. As far as I can tell, if you compile something from source you must also have the source code for all it's dependencies. Oct 10, 2015 at 10:56
  • 2
    This answer still applies to PHP7 for any PHP7 experimenters coming here
    – samrap
    Oct 11, 2015 at 5:41
13

For the latest versions it is needed to install libxml++2.6-dev like that:

apt-get install libxml++2.6-dev
0
11

I had the same issue when I used a DockerFile. My Docker is based on the php:5.5-apache image.

I got that error when executing the command RUN docker-php-ext-install soap

I have solved it by adding the following command to my Dockerfile:

RUN apt-get update && apt-get install -y libxml2-dev
0
5

Ubuntu, Debian:

sudo apt install libxml2-dev

Centos:

sudo yum install libxml2-devel
0

this solution it gonna be ok on Redhat 8.0

sudo yum install libxml2-devel

0

OpenSuse

"sudo zypper install libxml2-devel"

It will install any other dependencies or required packages/libraries

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.