How do you enable PHP4 and 5

Whether you are using Linux on the desktop or as a server, it's still good that you're using Linux. Linux related questions go here.

Moderator: General Moderators

Post Reply
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

How do you enable PHP4 and 5

Post by alex.barylski »

Can they run at the same time or do they conflict? How do you set it up so they can run on the same machine, but not at the same time?
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: How do you enable PHP4 and 5

Post by Christopher »

I think people who run them simultaneously run one as a CGI. I suppose you could just mod_rewrite to 'cgi-bin/php' instead of 'index.php' and clean URLs would be the same.
(#10850)
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Re: How do you enable PHP4 and 5

Post by Ollie Saunders »

You can run then in the same apache as long as you use shared object and disambiguate them with .php4 and .php5 extensions (or whatever takes your fancy)
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Re: How do you enable PHP4 and 5

Post by alex.barylski »

I think people who run them simultaneously run one as a CGI. I suppose you could just mod_rewrite to 'cgi-bin/php' instead of 'index.php' and clean URLs would be the same.
Hmmm...interesting...didn't even think of that one...
Ollie Saunders wrote:You can run then in the same apache as long as you use shared object and disambiguate them with .php4 and .php5 extensions (or whatever takes your fancy)
Same Apache instance...but how do you tell Apache to run PHP4 or PHP5? Requiring the extension would be a PITA...what happens to legacy PHP applications? Do I change their extensions from php4 to php5? It owuld be ideal if I could put php4 applications in a php4 directory and php5 applications in another directory.
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

Re: How do you enable PHP4 and 5

Post by Eran »

One solution to end them all: http://hurring.com/scott/howto/php4_and_php5/
Alan01252
Forum Newbie
Posts: 12
Joined: Sun Aug 03, 2008 3:20 pm

Re: How do you enable PHP4 and 5

Post by Alan01252 »

You can also do this by placing a .htaccess file in the directory with the line

AddHandler application/x-httpd-php4 .php

obviously substitute php4 for php 5 depending on what you want the scripts in the directory to use.
Post Reply