lime icon

Phosphorus and Lime

A Developer's Broadsheet

This blog has been deprecated. Please visit my new blog at klenwell.com/press.
Farewell
In the course of human events, to paraphrase a famous document, it is sometimes necessary to say goodbye. And I'm saying goodbye to Blogger. For this blog anyway. I'm finally moving to WordPress.

Blogger is a solid platform with many user-friendly (not to mention, spammer-friendly) features. It has continued to improve steadily since Google acquired it. But you're still at the mercy of Google's sometimes inconsistent censorship policies.

Beyond the control it affords the blogging developer, WordPress is a really impressive platform. It has rich features and, in spite of this, an easy intuitive interface.

This blog will continue to exist as an archive, so long as Google is gracious enough to host it. But beginning with the New Year, all futures posts will be posted to my new Klenwell blog. Hope to see you there.
PHP4 and PHP5 on the Same Apache Server
This post has been updated. Please see: http://www.klenwell.com/press/2009/02/php4-php5-one-server/


My goal seemed pretty simple: put PHP4 and PHP5 on my local Apache server so that I can easily test a couple applications that still need to work with PHP4. This is for Ubuntu.

I found a pretty good guide here:
http://www.howtoforge.com/apache2_with_php5_and_php4

The only problem is that php4-cgi is no longer in the Ubuntu repositories.

The solution turned out to be pretty easy in the end. Just add one of the old repositories that still has it to your sources list. But it took me the better part of an evening to hunt down that solution.

So here's my step-by-step guide to installing PHP4 to run along side PHP5 on my Apache server on Ubuntu 7.10:

# add breezy to sources
$ sudo gedit /etc/apt/sources.list

# added the following lines
deb http://old-releases.ubuntu.com/ubuntu/ breezy-updates main restricted
deb http://old-releases.ubuntu.com/ubuntu/ breezy-security main restricted
deb http://old-releases.ubuntu.com/ubuntu/ breezy main restricted
deb http://old-releases.ubuntu.com/ubuntu/ breezy universe
deb http://old-releases.ubuntu.com/ubuntu/ breezy-security universe

$ apt-get update

# back up apache2 config file
$ sudo cp apache2.conf /tmp/apache2.conf

# install php4-cgi
$ sudo apt-get install php4-cgi

# install php4 packages
$ sudo apt-get install php4-curl php4-domxml php4-gd php4-imap php4-ldap php4-mcal php4-mcrypt php4-mhash php4-mysql php4-odbc php4-snmp php4-xslt curl libwww-perl imagemagick

# edit apache2 config
$ /etc/apache2/apache2.conf.

# replace line:
DirectoryIndex index.html index.cgi index.pl index.php index.xhtml

# with:
DirectoryIndex index.html index.htm index.shtml index.cgi index.pl index.php index.php4 index.xhtml

# And add lines:
AddHandler php-script .php4
Action php-script /cgi-bin/php4

# enable mods and restart
$ sudo a2enmod actions
$ /etc/init.d/apache2 restart


If you need to deviate from this, I probably won't be much help. But I hope it saves someone a little precious time.

Labels: , ,