PHP4 for feisty - pbuilder for beginners

I helped Robbster out on #clug today, building php4 for feisty (it’s been dropped after edgy, in favour of php5). If you want to install it, don’t care about security holes, and want to use the debs I created, add this line to your apt sources list, and go wild:

deb ./

If on the other hand you want to know how to do it (so when the next PHP security hole appears tomorrow, you can build the latest version yourself), read on:

I’ve never used pbuilder before, so it was fun:

# aptitude install pbuilder

Edit /etc/pbuilderrc to point to your closest mirror, and uncomment the COMPONENTSline (so that you get universe included)

# pbuilder create

Now pbuilder is ready for work. Get the latest sources from debian (Download those 3 files at the end, dsc, orig.tar.gz and diff)

# pbuilder build *.dsc

Sit back and watch…

When it’s done, you probably want to create a trivial repository of your debs:

# cd /var/cache/pbuilder/result/; dpkg-scanpackages . /dev/null | gzip -c -9 > Packages.gz

Then add this to your sources.list

deb file:///var/cache/pbuilder/result/ ./

Wohoo. Remember to watch out for those security holes…


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

After installing php4 using tu

After installing php4 using tumbleweed's .deb files (above), we need to configure apache

It's not difficult:

  1. enable the actions module sudo ln -s /etc/apache2/mods-available/actions.load /etc/apache2/mods-enabled/actions.load (the command above is one line)
  2. restart apache sudo /etc/init.d/apache2 restart
  3. add a .htaccess file in the directory that you want to have php4 handle.

Overwrite the default php5 handler with the php4 cgi handler

AddHandler php-script .php
Action php-script /cgi-bin/php4

and it is all done!

NOTE: there are serious security considerations with running php4 and especially with php4 as a cgi module. .... but if you're like me and need to develop and test against php4, this works just fine.


php4 in gutsy

Upgrading to Ubuntu Gutsy and (still) needing php4 support is a problem. After trying to get pbuilder to create ‘official’ debs for php4 I gave up - too many esoteric dependencies.

I took a chance and installed the stock debian etch debs for php4 and they work just fine. Use your favourite debian mirror to find them in

Great post!

Thanks for the help!

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.