Mar 04
Making Leopard PHP a better PHP by adding GD support
Command Line Tricks, MacOS X Annoyances 5 Comments »
The nice thing about MacOS X 10.5 Leopard is that it comes with PHP 5.2.4 pre-installed. Unfortunately one of the features Apple choose not to compile in was support for the GD graphics library, which I use extensively. Furthermore compiling in new features has proven to be somewhat troublesome. When I tried to configure PHP 5.2.5 on my Leopard box which the following commands (a variant of the configure command I would issue under Tiger with no complaints):
The result was a failed configure due to an error in mysql configuration. I pinned this down to a request for a library at./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 --with-dom --enable-exif --enable-ftp --enable-mbstring --enable-mbregex --enable-dbx --enable-sockets --with-iodbc=/usr --with-curl=/usr --with-iconv=shared,/opt/local --with-openssl=shared,/opt/local --with-xmlrpc --with-xsl=/usr --with-config-file-path=/etc --sysconfdir=/private/etc --with-gd=/opt/local --enable-gd-native-ttf --with-jpeg-dir=/opt/local --with-tiff-dir=/opt/local --with-png-dir=/opt/local --with-freetype-dir=/usr/X11 --with-xpm-dir=/usr/X11 --with-pdflib=/opt/local --with-gettext=/opt/local --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-pdo-mysql=/usr/local/mysql --without-pear
/usr/local/mysql/lib/mysql/libmysqlclient.15.dylib which is actually located one directory up. This can be fixed via the command line using:
Then thecd /usr/local/mysql/lib mkdir mysql cp libmysqlclient.15.dylib mysql/libmysqlclient.15.dylib
./configure worked just fine. Unfortunately, when I did a
to compile the PHP and test it, there was no happiness. There were over 50 errors, some of them major. Crud. This is just the setup. See, all I needed was GD graphics library support in PHP for my website. Well, after googling for some time for some master hacker’s notes on getting PHP 5.2.5 to compile on Leopard, I discovered a fellow named Hill Pei had hacked GD support into the Leopard PHP without too much effort. His method simply requires some comfort with the command line and editing text files. In five minutes, I had GD support with Leopard’s built-in PHP. Excellent! [Despite a report in the comments to the contrary. This still appears to be necessary if you apply Security Update 2008-002, which installs PHP version 5.2.5. In which case, you should grab the php 5.2.5 code and work from there. I can confirm Hill Pei's instructions do work after Security Update 20008-002 if you grab the PHP-5.2.5 code instead of 5.2.4 as he suggests.]make make test








