Home » Php » Install PHP 5 without libxml2

Install PHP 5 without libxml2

Posted by: admin July 12, 2020 Leave a comment


I am trying to install a copy of PHP 5 to my home directory on the school computer. The problem is that whenever I try, it complains that my copy of libxml2 is too outdated to work.

Is there any way I can install this without upgrading libxml2, since I don’t have permission to upgrade.

Any suggestions?

How to&Answers:

Alternatively, you can make an install of libxml in your home directory and pass configure the location where you’ve installed it, i.e.

--with-libxml-dir=<your local install>

When installing libxml, you just have to use the --prefix= option with configure to indicate that you don’t want to do a system install.

Assuming that you compiled the cli client (and that the lib search path for the current user and the apache user are the same), you check that the correct lib is linked with:

# ldd /usr/bin/php
linux-vdso.so.1 =>  (0x00007ffff71ff000)
libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00000030f3c00000)
libedit.so.0 => /usr/lib64/libedit.so.0 (0x00000030e8000000)
libncurses.so.5 => /lib64/libncurses.so.5 (0x00000030f7400000)
libgmp.so.3 => /usr/lib64/libgmp.so.3 (0x00000030e7800000)
libbz2.so.1 => /lib64/libbz2.so.1 (0x00000030f7800000)
libz.so.1 => /lib64/libz.so.1 (0x00000030e6c00000)
libpcre.so.0 => /lib64/libpcre.so.0 (0x00000030f9400000)
librt.so.1 => /lib64/librt.so.1 (0x00000030e7000000)
libm.so.6 => /lib64/libm.so.6 (0x00000030e5c00000)
libdl.so.2 => /lib64/libdl.so.2 (0x00000030e6400000)
libnsl.so.1 => /lib64/libnsl.so.1 (0x00000030f6800000)
libxml2.so.2 => /usr/lib64/libxml2.so.2 (0x00000030f2400000))
libssl.so.10 => /usr/lib64/libssl.so.10 (0x00000030f3000000)
libcrypto.so.10 => /usr/lib64/libcrypto.so.10 (0x00000030eb400000)
libc.so.6 => /lib64/libc.so.6 (0x00000030e6000000)
libresolv.so.2 => /lib64/libresolv.so.2 (0x00000030e7c00000)
libfreebl3.so => /lib64/libfreebl3.so (0x00000030f3800000)
libtinfo.so.5 => /lib64/libtinfo.so.5 (0x00000030f7c00000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00000030e6800000)
/lib64/ld-linux-x86-64.so.2 (0x00000030e5800000)

libxml is listed half-way down the library list.


If you don’t need xml support, just disable it as described on this page:

--disable-libxml --disable-dom --disable-simplexml --disable-xml --disable-xmlreader --disable-xmlwriter --without-pear

On the other hand, you can try to compiling a newer version of libxml without installing it.


There is some discussion of this issue in the discussion of the PHP configuration documentation. You can disable the XML features to avoid the problems, but you’ll loose lots of useful features:
--disable-libxml --disable-dom --disable-simplexml --disable-xml --disable-xmlreader --disable-xmlwriter --without-pear

Most comments strongly suggest this is a bad idea. I’d suggest trying to figure out how to get the xmllib upgraded.


what about installing xmltools ?