XML support for PHP

I am working on a dedicated server (ultralingua.com/ultralingua.dreamhost.com), trying to do some XML parsing in PHP. Unfortunately, the XML library does not appear to be available. For example, function_exists(‘xml_parser_create’) returns false.

When I look at the phpinfo() output, I see “Configure Command” equals:

‘./configure’ ‘–prefix=/usr/local/php5’ ‘–enable-fastcgi’ ‘–with-mysql=/usr’ ‘–enable-calendar’ ‘–enable-force-cgi-redirect’ ‘–with-config-file-path=/etc/php5/cgi’ ‘–enable-trans-sid’ ‘–with-gd’ ‘–with-ttf=/usr’ ‘–with-freetype-dir=/usr’ ‘–with-exif’ ‘–with-jpeg-dir=/usr’ ‘–with-png-dir=/usr’ ‘–with-zlib-dir=/usr’ ‘–enable-ftp’ ‘–with-curl=/usr’ ‘–with-mcrypt=/usr/local’ ‘–disable-libxml’ ‘–with-gettext’

That “–disable-libxml” seems like a problem.

So, I contacted DreamHost support, and they set me up with sudo access. On the advice of the support people, I tried the following.

  1. Created the file /etc/php5/cgi/php.ini.local, with

extension_dir="./"
extension=libxml.so

  1. Added a soft link from /etc/php5/cgi/libxml.so to /usr/lib/libxml.so.

  2. Waited three hours until the php.ini reconfigured. Now it contains my extra two lines.

Unfortunately, the XML module remains unavailable to me. Not surprisingly, the “Configure Command” still has “–disable-libxml” in it.

I have moderate experience in programming PHP, but none in setting it up and changing its configuration. I’d sure appreciate the wisdom of some more experienced people.

Thanks,

Jeff Ondich
ondich@ultralingua.com

If you’re on a dedicated server, you should be able to just remove the existing PHP installation and reinstall with the options you need.


If you want useful replies, ask smart questions.

What kcrist said, but you’ll also need to install LibXML as most certainly the version on your server is too low for PHP5.

DH used --disable-libxml to get past the LibXML dependency that PHP5 has.