Well I’ve got it working, it took some time because there was an older library in the PHP4 directory structure from Server Logistics that didn’t like PHP5 ! The XML library needed an upgrade to be included into PHP5 so I first had to solve that issue to get it all working. The only library I had to exclude was SNMP for the same reason as I had to leave it out from the PHP 4.4.2 compilation. The rest of the libraries that are used from the original PHP4 installation from Server Logistics so please install that before you try this upgrade.

First you need to download the sourcecode for the new libxml2 library, you can get it from the GNOME ftp server. I’ve downloaded and used the latest version which was at this time version 2.6.23.

Extract the archive into a directory and run the following commands in a Terminal ./configure and make as we’ve done so many times already. When it is finished compiling you can install the library by running sudo make install and when that is done you’ll have to create a copy of the library in the directory /Library/PHP5/lib/ which you can do with the command sudo cp /usr/local/lib/libxml2.2.6.23.dylib /Library/PHP5/lib

When this is done you can start downloading from www.php.net. Extract the source archive into a directory and use the Terminal to execute the following commands:

sed 's/\(LIBS="\)\(-lpspell \$LIBS"\)/\1-laspell \2/' configure > configure.1
mv configure.1 configure
chmod a+x configure

This makes some changes to which library gets used during compilation just like the PHP4 script. Now you are ready to run the configure script. Please feel free to remove options you don’t see any need for, I tried to get everything in there that Server Logistics provided in their package.

./configure \
--prefix=/Library/PHP5 \
--with-apxs2=/Library/Apache2/bin/apxs \
--disable-cgi \
--enable-magic-quotes \
--disable-short-tags \
--with-openssl=/usr \
--with-zlib \
--with-zlib-dir=/usr \
--enable-bcmath \
--with-bz2=/usr \
--enable-calendar \
--enable-dba \
--enable-dbase \
--enable-dbx \
--enable-dio \
--enable-exif \
--enable-ftp \
--with-gd \
--with-jpeg-dir=/Library/PHP4 \
--with-png-dir=/Library/PHP4 \
--enable-gd-native-ttf \
--with-gettext=/Library/PHP4 \
--with-iconv=/usr \
--with-iconv-dir=/usr \
--with-imap=/Library/PHP4 \
--with-imap-ssl=/usr \
--enable-mbstring \
--with-mcrypt=/Library/PHP4 \
--with-mhash=/Library/PHP4 \
--with-mysql=/Library/MySQL \
--enable-embedded-mysqli \
--with-ncurses=/usr \
--with-pspell=/Library/PHP4 \
--enable-shmop \
--with-openssl-dir=/usr \
--enable-soap \
--enable-sockets \
--enable-wddx \
--with-expat-dir=/Library/Apache2 \
--with-xsl=/Library/PHP5 \
--enable-yp \
--enable-shared \

If this ends then

sed '/INCLUDES/s/^\(.*\)\( -I\/Library\/PHP4\/include \)\(.*\)$/\1 \3 \2/' Makefile > Makefile.1
mv Makefile.1 Makefile

When ready you can try to compile, you’ll be getting a lot of warnings and it will take a while. Compile by issuing the command:

When you are ready and made proper backups of your production environment you can issue the install command:

sudo make install

This updates your httpd.conf file as well by adding the entries PHP5, but it doesn’t remove any entries for PHP4. You’ll have to remove them yourself and restart Apache.

Please note that there isn’t a php.ini file in the configured directory /Library/PHP5/lib. You can copy one from the source directory or the one from your PHP4 installation.