php5 and php4 on the same server

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Heavy
Forum Contributor
Posts: 478
Joined: Sun Sep 22, 2002 7:36 am
Location: Viksjöfors, Hälsingland, Sweden
Contact:

php5 and php4 on the same server

Post by Heavy »

Anyone have experience using php4 and php5 on the same apache server under unix?

I want to try it out, but have only server computer. I would like to have both systems on the same apache server.

How can I do that?
Anyone done that and run into problems?
Cruzado_Mainfrm
Forum Contributor
Posts: 346
Joined: Sun Jun 15, 2003 11:22 pm
Location: Miami, FL

Post by Cruzado_Mainfrm »

i think you can,
in the httpd.conf, where you have your directives that specify where is the PHP interpreter located, use something like this:

Code: Select all

# Specify both php4 and php5 locations
ScriptAlias /php4/ "C:/usr/local/php4/"
ScriptAlias /php5/ "C:/usr/local/php5/"

# Only a little modification
AddType application/x-httpd-php3 .php3
AddType application/x-httpd-php3-source .phps
# Note the end of the line below
AddType application/x-httpd-php .php .php4 .php5
AddType application/x-httpd-php-source .phps

# Script Handlers
AddHandler php3-script .php3
AddHandler php5-script .php5
AddHandler php-script .php .php4

# Leave this two with php4 if you want
Action php3-script /php4/php.exe
Action php-script /php4/php.exe 

# Modification for php5
Action php5-script /php5/php.exe
and i think that's it :D
edit it to fit your needs of course
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post by JAM »

Cruzado_Mainfrm wrote:i think you can,
in the httpd.conf, where you have your directives that specify where is the PHP interpreter located, use something like ... <cut>
Just wanted to agree with Cruzado_Mainfrm and leave a note that it should work, as I once tested this between php 3.x & 4.x.
Cruzado_Mainfrm
Forum Contributor
Posts: 346
Joined: Sun Jun 15, 2003 11:22 pm
Location: Miami, FL

Post by Cruzado_Mainfrm »

the only concern is the php.ini file, but that is for windows, i don't know what file UNIX might use..., if it does :D
User avatar
Heavy
Forum Contributor
Posts: 478
Joined: Sun Sep 22, 2002 7:36 am
Location: Viksjöfors, Hälsingland, Sweden
Contact:

Post by Heavy »

Thanks guys.
Cruzado_Mainfrm wrote:the only concern is the php.ini file, but that is for windows, i don't know what file UNIX might use..., if it does :D
Maybe if I recompile one of them with some special configure directive, to make that version look for php.ini somewhere else.
User avatar
Heavy
Forum Contributor
Posts: 478
Joined: Sun Sep 22, 2002 7:36 am
Location: Viksjöfors, Hälsingland, Sweden
Contact:

Post by Heavy »

I actually believe one should check out for some more things, like where the different very alike systems store their session data etc, so a collision could be avoided.

I don't know much about this, but I guess it should be possible.
Post Reply