Saturday, March 03, 2007

latest php 5.2.x on old iBook running panther

When I took that 12" iBook in 2005 I never thought it was going to last full 2 years. I had subjected it to pretty rigorous tests installing and compiling a lot of stuff. The age is showing now , nothing hardware wise ;o) but it is becoming increasingly difficult to maintain it as a development machine now. All the documents for all the tools now a day mention tiger only. Most of my libraries are way too old and attempting to install anything usually starts a "I-cant-find-this-also" chain reactions. The last time that I tried was to install ImageMagick with ruby and I gave up after some time. It has been my internet terminal since then.

So today when my brother asked me to install latest PHP on it I was really apprehensive. Now I do not want to start a libraries chase on a Saturday afternoon. PHP is supposed to be a big library with lot of dependencies and I was sure that I will give up this time also. But whoa!!! what a surprise!!! I did the install in 2 hours flat on mac os x 10.3.9! and i can not believe it. Those who find it hard to believe that installing something can take 2 hours have , well, obviously, not installed lot of things in life!

I started with this PHP mac article. Follow the article to the letter. Only difference is I download 2.0.59 instead of 2.2.x series and i chose my prefix to be /opt/apache2. Apache installed nice and smooth. The I downloaded PHP 5.2.1 tarball and did a configure and make. The configuration options I chose were to build with GD and mysql . ( we want image manipulation etc). I did not use all the switches mentioned in the article but YMMV. Here I ran into my first issue of a header file xmlsave.h not found.

Looks like PHP needs latest libxml headers and my panther was missing those. The best help I got from net was reading this blog and also the same PHP mac article mentioned above. So i decided to install libxml also. Install is pretty simple, just run configure and make and you will get libxml installed in /usr/local. Now you have to go back and configure PHP to build against your libxml. There is no need to install new version of libxml in /usr as it may break existing things. To configure PHP you should use --with-libxml-dir=/usr/local option now. Doing so and running make again I ran into my second issue.

The second issue came out to be a documented bug and you can read more on supplied link. I do not know what is the issue but downloading the latest snapshot and compiling again built the PHP 5.2.x for me. I had installed JPEG and PNG libraries using fink some time back. The GD built fine against those libraries. So yipeee now we have latest PHP and the iBook gets an elevated status of development machine.






© Life of a third world developer
Maira Gall