This is a small write-up of the installation I was asked to do for a client on his mini with OS X Server (Leopard). It took me a while to get this working because of the various issiues that I encountered and while googling for a sollution found that there are many people looking for an answer, hence the write-up. Please note that these instructions are not part of the normal documentation set, these instructions only work on OS X Server Leopard and not on the regular OS X Workstation.
First make a copy of the original php module for safekeeping:
Then we need to make some preparations. First of them is get the MySQL include source files and the client libraries as documented in this knowledge base article. Remeber this is only tested on 10.5.x of OS X Server.
Please download http://www.opensource.apple.com/darwinsource/other/MySQL-49.binaries.tar.gz
Unpack and copy the following directories using the following commands:
cd usr/include/
sudo cp -R usr/include/mysql /usr/include/
sudo cp -R usr/lib/mysql /usr/lib/
Next we need to get the iconv library and compile it to get it properly working with PHP. The default iconv library on OS X gives linking errors. You can download it from: http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz and unpack it.
Use the following commands to compile and install it:
CFLAGS=”-arch x86_64″ \
CXXFLAGS=”-arch x86_64″
./configure –prefix=/usr/local
make
sudo make install
Next download the source code for the JPEG library from the Freshmeat libjpeg project. I’ve used the source file jpegsrc.v7.tar.gz.
First unpack the source code and then go into the folder “jpeg-7″ for the source and execute the following commands:
cp /usr/share/libtool/config.guess .
Which will copy these files to the current directory. They are required for the configuration fase of this installation.
CFLAGS="-arch x86_64" \
CXXFLAGS="-arch x86_64" \
LDFLAGS="-arch x86_64" \
./configure --enable-shared
make
sudo make install
Next download PHP version 5.2.11 (this is the version installed on OS X Server 10.5.x) unpack it and use the following commands to configure, compile and install it:
CFLAGS=”-arch x86_64″ \
CXXFLAGS=”-arch x86_64″
./configure –prefix=/usr \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--disable-dependency-tracking \
--with-apxs2=/usr/sbin/apxs \
--with-ldap=/usr \
--with-kerberos=/usr \
--enable-cli \
--with-zlib-dir=/usr \
--enable-trans-sid \
--with-xml \
--enable-exif \
--enable-ftp \
--enable-mbstring \
--enable-mbregex \
--enable-dbx \
--enable-sockets \
--with-iodbc=/usr \
--with-curl=/usr \
--with-config-file-path=/etc \
--sysconfdir=/private/etc \
--with-openssl \
--with-xmlrpc \
--with-xsl=/usr \
--with-mysql-sock=/var/mysql \
--with-mysqli=/usr/bin/mysql_config \
--with-mysql=/usr \
--with-gd \
--with-jpeg-dir=/usr/local/lib \
--with-png-dir=/usr/X11R6 \
--with-freetype-dir=/usr/X11R6 \
--with-xpm-dir=/usr/X11R6 \
--with-iconv=/usr/local \
--without-pear
Next do not start compiling but we need to edit the Makefile.
Find the line that starts with:
and add at the end of the line:
The nfind the line that starts with:
and add at the end of this multiline:
Next replace the line:
with:
Save the file and when your done you can start compiling and installing with:
sudo make install
This means it’s ready.
Now restart apache and check your site. Now you have a new PHP version with GD on your server.


