Friday, September 22, 2006

PHP 5 Support in Mac OS X Tiger Server

Yesterday I just got Mac OS X Tiger Server installed on my PowerMac G5. After several hours exploring, I'd say it's really a dream OS for web developers like me. Apple has made a lot beautiful and useful GUI tools for open source software like Apache web server, with these GUI tools even veteran Unix gurus can save a lot time on configurations & monitoring. For example I really really like the sleek Apache monitoring graph, it's a bit like what you may have ever seen in Zeus, right?

Mac OS X Tiger Server

But soon I found that its out-of-box PHP support is still 4.x, hmm not so good, my own application in development needs at least PHP 5.0, so I tried to add PHP 5 support to Mac OS X Tiger Server's httpd 1.3.

According to the manual pages of Tiger Server, Apache 2.0 is shipped with the OS but just for evaluation purpose, and the beautiful monitoring graph tools seem to be only for httpd 1.3, so I grabbed the latest PHP 5.1.6 source tarball from php.net and created a simple configuration script for it:

./configure --prefix=/opt/local/php-5.1 --with-apxs --with-zlib --with-xml --with-gettext=/opt/local --with-gd --with-jpeg-dir=/opt/local --with-png-dir=/opt/local --with-mcrypt=/opt/local --with-mysql=/usr --with-mysqli --with-pdo-mysql=/usr --with-freetype-dir=/opt/local --enable-mbstring --enable-sockets --enable-gd-native-ttf --enable-calendar --enable-soap --enable-shmop --enable-cli --enable-bcmath --enable-dba --with-inifile --enable-exif --enable-ftp --enable-sqlite-utf8 --enable-wddx

You may ask what is /opt/local stuff? It's the location of packages installed by MacPorts, which is the best way to install open source software under Mac OS X.

Run this script and then make & sudo make install, you'll get PHP 5 support in Mac OS X Tiger Server.

I tried to compile PHP with MySQL 5.1.11 downloaded from MySQL Developer Zone, but it failed with a lot error messages. So I chose to use the shipped version which is installed under /usr.

1 comment:

Edmont Dantes said...

So that would give me php5 support on my tiger server installation while maintaining the ability to control my server though the gui?