September 13, 2006

The future can only tell if this love is true or not, right?

I spent the other night trying to compile PHP5 under Mac OS 10.3 for a couple hours but every time I get to the compilation phase I was getting the same error:
/Users/alice/php-5.1.6/ext/libxml/libxml.c:43:28: libxml/xmlsave.h: No such file or directory

I figured out what I needed to do, but since I couldn’t google for a decent answer I figured I should publish what worked for me.

Basically, the libxml that ships with Panther is older than the version PHP5 is expecting at compilation time. According to the help message for ./configure there’s a --with-libxml-dir flag you can use, but I wasn’t actually able to get that to work. Instead it was easier to upgrade my version of libxml.

Go to http://www.xmlsoft.org/ and get the newest source package of libxml2. Next you need to install it, but since PHP5’s Makefile looks in /usr/include you need to change the default prefix for the libxml2 installation. You can do this using the flag:
./configure --prefix=/usr

This will put the correct C files into /usr/include/libxml2/libxml and you can then build PHP5 with no problems.

I don’t recall having this problem with Tiger, and looking on my iBook it appears the default shipped version of libxml2 is more up to date (although I may have installed a new version before, I don’t think I did at least). There’s probably a way to get libxml2 to install in /usr instead of in /opt, but I haven’t figured that out yet.

Posted by magicalgirl at 9:41 pm
Powered by WordPress
Opinions expressed on this site are mine alone and do not represent those of my employer, my employer's business partners, my friends, family, or even trolls living under bridges.
Portions of this website may not work in Safari (and I really don't care).