Installing php4 alongside php5

Hey guys,

Does anyone have any experience of installing php4 alongside php5 and then switching between the two on a per site basis?

I've seen it done on shared hosting but not sure where to start on my own server.

I've already got php5 installed but I'm concerned that if I can stumbling in and blindly install php4 it'll somehow overwrite 5.

Any pointers would be much appreciated.



3 Replies

What's your distribution? Do you have a specific script that absolutely requires PHP4, or are you just trying to see if it's possible?

Howtoforge used to have some tutorials for installing both PHP4 and PHP5 using (Fast)CGI, but that was several years ago.

Most distros don't even ship PHP4 these days, because PHP4 hasn't received security update in over two years. You may have to hunt down the 4.4.9 source code and compile it yourself.

The web hosts that still support PHP4 do so at their own risk. Actually, if I were choosing a web host, I'd avoid the ones that even mentioned PHP4 because it's a time bomb just waiting to blow up.


Thanks for the reply.

I'm running Ubuntu but to be honest, I've decided it's not worth the effort!

Cheers anyway,



I have done it on a lot of servers, I installed PHP5 using packages but installed PHP4 using source code. I then setup apache using a proxy so port 80 went to PHP5 and port 81 went to a different apache instance that ran PHP4.

You then setup the v-hosts so that the sites you want to run PHP4 are redirected using the proxy to the PHP4 instance on port 81.

Its messy, but it did work well. Problems were logging, updates etc…

We have now dropped to PHP5 across the board

Hope it gives you some ideas



Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct