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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.