How to fix error with xml2-config not found when installing PHP from sources?
Asked Answered
H

6

227

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.
Homburg answered 11/11, 2013 at 10:30 Comment(1)
Related: How to fix PHP installation when xml2-config is missing?Mcmaster
H
477

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
Homburg answered 11/11, 2013 at 10:30 Comment(9)
I'm using centos 6.4, for me the package was called libxml2-develGreenes
the same error is for installing php 5.5 in centos 7Homburg
for the error in centos 7 run: sudo yum install libxml2-develHomburg
Does anyone know why the dev version is required over the standard libxml2 package?Decarbonize
@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.Ahner
This answer still applies to PHP7 for any PHP7 experimenters coming hereDeas
I install php7.10, and my libxml2-dev is installed, but the same error occured.Witte
I get libxml2-dev : Depends: libxml2 (= 2.9.3+dfsg1-1ubuntu0.5) but 2.9.4-1+deb.sury.org~xenial+2 is to be installedCommonweal
This command allowed me to install R packages XML and rlist since they depend on libxml2 to work.Pathan
B
14

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

apt-get install libxml++2.6-dev
Bolan answered 13/2, 2016 at 13:32 Comment(1)
This did the trick for me when trying to compile Zabbix 6.4 from source on Ubuntu.Cha
H
12

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
Halvah answered 26/12, 2018 at 12:7 Comment(0)
L
5

Ubuntu, Debian:

sudo apt install libxml2-dev

Centos:

sudo yum install libxml2-devel
Lorimer answered 6/2, 2020 at 12:39 Comment(0)
M
0

this solution it gonna be ok on Redhat 8.0

sudo yum install libxml2-devel

Medwin answered 16/12, 2019 at 2:11 Comment(0)
R
0

OpenSuse

"sudo zypper install libxml2-devel"

It will install any other dependencies or required packages/libraries

Rainey answered 1/4, 2020 at 18:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.