Compiling PHP 5 on Mac OS X
Note that the following will only work on Tiger, not on Panther nor Leopard!
1. Install Xcode; latest (currently 2.4) is always a good idea.
2. Install fink.
3. Install needed packages using fink:
sudo fink selfupdate sudo fink install libjpeg libtiff libpng3 libxml t1lib5 uw-imap-c-client-ssl libmcrypt libmhash ming mysql15-dev postgresql80-ssl-dev
Note: Continue with the other steps while this process. It will take a while!
For step 7, wait for this to complete.
4. Download FrontBase for Mac OS X. It comes in DMG/Installer form. Install it. Note: You can customize the installation, and deselect everything except FBDeveloperLibraries.
5. Install FreeTDS:
curl -O http://ibiblio.org/pub/Linux/ALPHA/freetds/stable/freetds-stable.tgz tar zxf freetds-stable.tgz rm freetds-stable.tgz cd freetds-0.64/ ./configure && make && sudo make install cd ..
6. Download latest PHP source; currently 5.2.5
Extract it.
7. Compile PHP
cd ~/Desktop/php-5.2.5 ./configure --prefix=/usr/local/php5 --with-apxs --with-config-file-scan-dir=/usr/local/php5/php.d --with-iconv --with-openssl=/usr --with-zlib=/usr --with-gd --enable-gd-native-ttf --with-libjpeg=/sw --with-libtiff=/sw --with-libpng=/sw --with-jpeg-dir=/sw --with-png-dir=/sw --with-zlib-dir=/usr --with-ldap --with-xmlrpc --with-iconv-dir=/usr --with-snmp=/usr --enable-exif --enable-wddx --enable-soap --enable-sqlite-utf8 --enable-ftp --enable-sockets --enable-dbx --enable-dbase --enable-mbstring --enable-calendar --enable-bcmath --with-bz2=/usr --with-curl --with-kerberos=/usr --with-imap=/sw/share/c-client/ --with-imap-ssl=/sw/share/c-client/ --with-iodbc=shared,/usr --with-json=shared --enable-memcache --with-libxml --with-xsl --with-pgsql=/sw --with-pdo-pgsql=/sw --with-pdflib --with-t1lib=/sw --with-gettext --with-ming=/sw --with-mcrypt=/sw --with-mhash=/sw --with-mssql=/usr/local --with-mysql=/sw --with-mysqli --with-pdo-mysql=/sw --with-fbsql OPTIM=-O2 make sudo make install
8. Edit your /etc/httpd/httpd.conf: Change
<IfModule mod_php4.c>
to
<IfModule mod_php5.c>
9. Restart Apache:
sudo apachectl stop sudo apachectl start
You can verify that your new php executable works fine by doing:
/usr/local/php5/bin/php -i | grep "Build Date"
Done.