PECL solr fails to install with “libxml/parser.h: No such file or directory”

When trying to install PECL module solr from WHM -> Module Installers, it fails to install PHP Solr extension and you may receive the following error:

fatal error: libxml/parser.h: No such file or directory

NOTE: Before getting this error the libcurl-devel rpm needed to be installed using the following command on CentOS / CloudLinux Server:

yum install libcurl-devel

Workaround

The work around is to link the folder to where the libxml library will be found. This is simply done using the following command:

ln -s /usr/include/libxml2/libxml /usr/include/

Once you create a necessary symlink using the above command, you will be able to install solr PECL module from WHM without any error.

Leave a Reply