Published January 8th, 2003 by Jim O'Halloran

Building Apache 2 and PHP 4.

I notice that Jesse Lawrence is wondering how to get recent versions of Apache and PHP to play with an older MySQL… I’m no guru, but I’ve got Apache 2.0.42, and PHP 4.2.3 compiled and running, talking to both Microsoft SQL Server 7.0 and MySQL 3.23.49 (default with RedHat 7.3).

Firstly, a little organisation. I’ve untar’ed the sources for Apache, PHP, etc into /usr/src, which means I ended up with /usr/src/httpd-2.0.42, etc. I then created a symlink to remove the version number from the directory names (ie. ln -s httpd-2.0.42 httpd). This means that I can have serveral versions of Apache source on my system and have the symlink point to the one I’m currently using. This means my /usr/src looks a bit like this (edited)…

[root@snares src]# ll
drwxr-xr-x    6 jim      jim          4096 Oct 30 11:17 freetds
lrwxrwxrwx    1 root     root           12 Oct 30 09:08 httpd -> httpd-2.0.42
drwxr-xr-x   12 root     root         4096 Oct 30 11:20 httpd-2.0.42
lrwxrwxrwx    1 root     root           14 Oct 30 09:09 openssl -> openssl-0.9.6g
drwxr-xr-x   20 root     root         4096 Oct 30 11:13 openssl-0.9.6g
lrwxrwxrwx    1 root     root            9 Oct 30 09:08 php -> php-4.2.3
drwxr-xr-x   16 1002     games        4096 Oct 30 11:22 php-4.2.3

The other thing I did was to put all of the configure and make commands into a script so that I can build the same setup again, without remembering all of the command line parameters. The script uses the symlinked directory names, not the actual ones.

The advantage of the symlinks and the script is that for minor upgrades all I need to do is untar the new source, change the symlinks and run the script and we’re all done. If something goes wrong, change the symlink back, run the script again, and we’re back to our known working setup. Very simple upgrade and fall back.

Anyway, here’s a copy of the script I use to build Apache 2.0 and PHP 4.2 with MySQL and MS SQL Server support. This one has been edited to remove the SSL and FreeTDS (MS SQL Server) stuff, its untested, but is should be close to the mark.

An upgrade to PHP 4.3 scheduled in the next few days, so I’ll post any updates once its done.


1 Response to “Building Apache 2 and PHP 4.”

Feed for this Entry
  1. 1

    Corey Furman Says

    I just finished working through this script. Thanks for providing it. In my environment, it didn’t work out of the box, so I changed it, and IMHO I may have improved it. Would you like it?

    I plan to write an article for devshed with it as a basis. That way I get to give back.

    Again, Thanks!

Leave a Reply

XHTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>