Running php4 and php5 next to each other PDF Print E-mail
Written by Websmurf   
Thursday, 02 February 2006
As a webdeveloper i'm running into the problems that i can only easily test in php4 or php5 and not at the same time. After some searching on the internet i found a neat way of running both php4 and php5 on the same server (windows based). I'm not going to explain how to install php4 here, I expect you to have php4 running as a module allready.

First make sure your apache server is listening on two ports on your server, for example port 80 and 81
Listen 80
Listen 81


After this, go to your virtual host section in the apache configuration.

Create a new VirtualHost section with this in it:
<virtualHost *:81>
    ServerAdmin This e-mail address is being protected from spam bots, you need JavaScript enabled to view it
    ServerName server
   
    SetEnv PHPRC C:/php5/
    ScriptAlias /php/ "C:/php5/"
    Action php5-script /php/php-cgi.exe
    AddHandler php5-script .php
</virtualhost>


That will make apache run php5 when visiting through port 81 and php4 when visiting through port 80.
To avoid problems with php.ini files, you'd best copy your php.ini file of php4 to C:/program files/apache groups/apache and keep your php5 php.ini in C:/php5/


Last Updated ( Thursday, 02 February 2006 )