Jump to content

Difficulty switching between php 5.2.x and php 5.3 on apache


thepreacher

Recommended Posts

I have both php 5.2.x and php 5.3 setup and working on apache2.2. However when i try to switch between them apache restart fails depending on which one of the directories appears in the environment path first.

 

eg. I an currently runing php 5.2 and on the environment path i have

;c:\php5.2;c:\php5.3;...

 

in httpd.conf i have

####### PHP Config ###########
LoadModule php5_module "C:/php5.2/php5apache2_2.dll"
AddType application/x-httpd-php .php .phtml .php3
PHPIniDir "C:/php5.2"

#LoadModule php5_module "C:/php5.3/php5apache2_2.dll"
#AddType application/x-httpd-php .php .phtml .php3
#PHPIniDir "C:/php5.3"
############################## 

 

To switch to php 5.3 i uncomment the line for ver 5.3 and comment out those for ver 5.2 then I save and restart apache. However i get a failure message. unless i go into the environment path on windows and then reverse their positions

;c:\php5.3;c:\php5.2;...

and reboot before it works.

 

Is there an easier way to switch between two versions of php without the constant path chnage and rebooting? I don't want to use xampp or wamp.

The problem is when use PHP5.3 it will use the .dlls for 5.2.x as its the first item in the PATH Environment Variable.

 

What you are better of doing is download PHP5.2.x zip package and extract the contents of it to C:/php. Then Download the zip package for PHP5.3 and extract it to C:/php5.3. Add ONLY C:/php to your PATH. Now add the following to Apaches httpd config.

 

LoadModule php5_module "C:/php/php5apache2_2.dll"
AddType application/x-httpd-php .php .phtml .php3
PHPIniDir "C:/php"

 

When you start Apache it will be using PHP5.2. To swap versions simply stop Apache and rename C:/php to C:/php5.2 and C:/php5.3 to C:/php. When you start Apache it should be using PHP5.3. To go back to PHP5.2 just rename the folders again. Pain in the arse but it should work.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.