Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

PHP4 was removed from lenny package lists. Any suggestions what might be the best approach to install php4 (Apache mod and cli) on a lenny box without breaking php5? And possibly still having the ability to uninstall later on.

share|improve this question
up vote 2 down vote accepted

It should be possible to install php4 along side php5; they were available before and the packaging was designed to have php4 or php5 in the paths that they used. The easiest thing to do would be to download the source packages for php4 from sarge, extract them using:

# dpkg-source -x php4.dsc

cd into the newly created directory, then build it using:

# debuild -us -uc -b

This should then create the packages you need in the parent directory. I've missed out the version numbers in the .dsc file name.

share|improve this answer
Could you tell me how can I obtain the source packages from sarge? By adding some repository to sources.list or by manual download? Can't seem to find it. – Karolis T. Jun 12 '09 at 7:42
Apologies, I meant Etch. You can find the source on the right hand side of You'll want all three files. – David Pashley Jun 12 '09 at 9:23
Thanks, I have it now and am battling with the dependencies. – Karolis T. Jun 12 '09 at 10:19
That might be why it was removed :) Most of the time you can probably just up any version numbers in debian/control to match what is in Lenny. In some cases, you may need to do the same procedure with a dependency. – David Pashley Jun 12 '09 at 10:28

Hmmm an apt-cache search php4 on my Debian/Squeeze workstation lists tons of php4 packages, are you sure it has been removed?

I'd say there are 2 Options:


Forward port php4, you need to apt-get source the package in question, and simply rebuild it on a lenny box. I won't go into details as different dependencies might need quite some amount of time to figure out (especially if you never forward ported packages before)


Not exactly the least interrupting solution but I think that OpenVZ is the perfect match for this.

OpenVZ is a container based virtualization, thus it doesn't really add any overhead. Overhead is slightly more than using a chroot environment, but a lot less than XEN or kvm.

We use it as a service seperation for nearly everything, the largest overhead it adds is some waste of disk storage which in these days isn't much of a problem.

You'd simply install OpenVZ (this needs a reboot) and debootstrap an etch instance right on the host, boot it add an IP and work just like with a normal box.

share|improve this answer
you could just use a chroot. – David Pashley Jun 12 '09 at 7:43
true but I found chroot to be a lot more cumbersome than openvz (once it's set up). – Server Horror Jun 12 '09 at 7:44
Thanks for your answer, I don't want to go OpenVZ route just yet, will have it in mind though. Here's my sources.list: <pre> deb stable main contrib non-free deb stable/non-US main contrib non-free deb stable/updates main contrib non-free deb-src stable main contrib non-free deb-src stable/non-US main contrib non-free </pre> apt-cache/aptitude doesn't return anything php4 related. – Karolis T. Jun 12 '09 at 7:45
Uh, sorry, thought <pre> tags worked same way in comments. – Karolis T. Jun 12 '09 at 7:46
It's possible that it's in squeeze because it was intentionally kept out of the stable release due to critical bugs. Having said that, I don't think I saw them this morning when I looked on – David Pashley Jun 12 '09 at 16:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.