This issue applies to WampServer 2.0, which I still use...
Summary:
Switching PHP Versions Fails... likely resulting from incorrect "phpversion"s applied in the variable for
FileName: "${c_phpCli}",
...also inappropriate automatic copying over the phpForApache.ini in other bin/php/phpx.x.x/ directories (cross copying) occurs. {don't know why this copy back into the php directory needs to take place, but it does}, effectively obliterating correct versions.
I read a few posts about people having similar problems (problem description details below), without really ever pinning down what is really going on or why, and with no real solutions.
Maybe this is fixed in later versions of WampServer2, however, since I ran into this problem and failed to find the answer here, I am posting the details of this issue, along with the resolution I discovered and am using ..for posterity if nothing else.
Maybe this helps someone else.
@yfastud: did this get fixed in newer releases?
Cheers,
TwoHawks ;^)
##########
PROBLEM DESCRIPTION: When Trying to Switch between them, after Installing additional versions of PHP, I observed the following symptoms:
- may receive errors that certain php extensions are failing to load,
- php version selected may fail to load entirely (crash)
- apache may crash
- apache's resultant php.ini file is the wrong version contents, even after a sucessful switch (during troubleshooting and obtaining limited success, this persisted, albeit, inconsistently)
- phpForApache.ini files in one php installation or the other will soon be overwritten... reverting to being the same as each other in the differnt php installations (one takes over after a while),
- the "Filename" for the "phpclient" variable in wamp configuration and ini files never changes from the originally installed version. (detailed below)
##########
WHATS GOING ON: I discovered that, in my installation anyway,
- $c_phpCliVersion = $wampConf['phpCliVersion']; in config.inc.php ...never changed from the original installed php version
- [phpCli] -- phpCliVersion = "x.x.x" never changes from the original installed php version
- so anywhere-- FileName: "${c_phpCli}"; --is being used (generated from wampmanager.tpl for wampmanager.ini as well as refresh.php) , the pathway to the intended php executable is incorrect (never switches from the originally installed version)
The result is a problem that eventually propogates throughout the installation.
##########
THE SOLUTION I USED: (this is not perfect, but it works well enough)
-------------
FIND IN WAMPSERVER.LIB.PHP
//on modifie la conf de wampserver
$wampIniNewContents['phpIniDir'] = $phpConf['phpIniDir'];
$wampIniNewContents['phpExeDir'] = $phpConf['phpExeDir'];
$wampIniNewContents['phpConfFile'] = $phpConf['phpConfFile'];
$wampIniNewContents['phpVersion'] = $newPhpVersion;
wampIniSet($configurationFile, $wampIniNewContents);
AFTER THIS LINE
$wampIniNewContents['phpVersion'] = $newPhpVersion;
ADD THIS LINE
$wampIniNewContents['phpCliVersion'] = $newPhpVersion;
##########
WHAT THIS DOES:
- the [phpCli] phpCliVersion value in wampmanager.conf will actually toggle when switching php pversion, rather than remaining stagnant.
- the value for the variable $c_phpCliVersion in config.inc.php will change accordingly, rather than remaining seemingly staticly set
- the value for the variable $c_phpCli in refresh.php will change accordingly, rather than remaining seemingly staticly set
- the values for all Filenames will be propogated to the php version selection you make when refresh.php runs
- php.ini in the apache directory will consistently be updated, and in the php directories...without overwriting phpForApache.ini with an incorrect version from another php directory
The only problem with this 'fix' is that the Filname used by different [switchPhpx.x.x] menus, generated under WAMPPHPVERSIONSTART menu-zone that is generated in wampmanager.ini by the relevant wamp php scripts, ...well, those menus shuold continue to use unique values for phpCliVersion's, i.e., those should not stay all the same.
It is not a huge issue, however. The only ramafication I have observed is during the initial switch php wil log a "Notice", one time only, similar to the following:
PHP Notice: Undefined variable: newHttpdContents in S:\wamp\scripts\wampserver.lib.php on line 104
################
TO COMPLETE THE DETAIL associated with this post, below I have copied excerpts from relevant files
#############################################
From WampManager.conf when 5.2.6 chosen
#############################################
[php]
phpVersion = "5.2.6"
phpLastKnown = 5.3.1
phpIniDir = "."
phpConfFile = "php.ini"
phpExeDir = "."
[phpCli]
phpCliVersion = 5.2.6 <--problem child
phpExeFile = php.exe
phpCliFile = php-win.exe
#############################################
From WampManager.conf when 5.3.1 chosen
#############################################
[php]
phpVersion = "5.3.1"
phpLastKnown = 5.2.6
phpIniDir = "."
phpConfFile = "php.ini"
phpExeDir = "."
[phpCli]
phpCliVersion = 5.2.6 <--problem child
phpExeFile = php.exe
phpCliFile = php-win.exe
#############################################
From WampManager.ini when 5.2.6 chosen
#############################################
[phpVersion]
;WAMPPHPVERSIONSTART
Type: item; Caption: "5.2.6"; Action: multi; Actions:switchPhp5.2.6; Glyph: 13
Type: item; Caption: "5.3.1"; Action: multi; Actions:switchPhp5.3.1
Type: separator;
Type: item; Caption: "Get more..."; Action: run; FileName: "C:\Program Files\Mozilla Firefox36x\firefox.exe"; Parameters: "[
www.wampserver.com];;
[switchPhp5.2.6]
Action: service; Service: wampapache; ServiceAction: stop; Flags: ignoreerrors waituntilterminated
Action: run; FileName: "S:/wamp/bin/php/php5.2.6/php-win.exe";Parameters: "switchPhpVersion.php 5.2.6";WorkingDir: "S:/wamp/scripts"; Flags: waituntilterminated
Action: run; FileName: "S:/wamp/bin/php/php5.2.6/php-win.exe";Parameters: "-c . refresh.php";WorkingDir: "S:/wamp/scripts"; Flags: waituntilterminated
Action: run; FileName: "net"; Parameters: "start wampapache"; ShowCmd: hidden; Flags: waituntilterminated
Action: resetservices
Action: readconfig;
[switchPhp5.3.1] <<<----------PROBLEM CHILD-------- ...(FileName)------>>>
Action: service; Service: wampapache; ServiceAction: stop; Flags: ignoreerrors waituntilterminated
Action: run; FileName: "S:/wamp/bin/php/php5.2.6/php-win.exe";Parameters: "switchPhpVersion.php 5.3.1";WorkingDir: "S:/wamp/scripts"; Flags: waituntilterminated
Action: run; FileName: "S:/wamp/bin/php/php5.2.6/php-win.exe";Parameters: "-c . refresh.php";WorkingDir: "S:/wamp/scripts"; Flags: waituntilterminated
Action: run; FileName: "net"; Parameters: "start wampapache"; ShowCmd: hidden; Flags: waituntilterminated
Action: resetservices
Action: readconfig;
;WAMPPHPVERSIONEND
##############################################
#############################################
From WampManager.ini when 5.3.1 chosen
#############################################
[phpVersion]
;WAMPPHPVERSIONSTART
Type: item; Caption: "5.2.6"; Action: multi; Actions:switchPhp5.2.6
Type: item; Caption: "5.3.1"; Action: multi; Actions:switchPhp5.3.1; Glyph: 13
Type: separator;
Type: item; Caption: "Get more..."; Action: run; FileName: "C:\Program Files\Mozilla Firefox36x\firefox.exe"; Parameters: "[
www.wampserver.com];;
[switchPhp5.2.6]
Action: service; Service: wampapache; ServiceAction: stop; Flags: ignoreerrors waituntilterminated
Action: run; FileName: "S:/wamp/bin/php/php5.2.6/php-win.exe";Parameters: "switchPhpVersion.php 5.2.6";WorkingDir: "S:/wamp/scripts"; Flags: waituntilterminated
Action: run; FileName: "S:/wamp/bin/php/php5.2.6/php-win.exe";Parameters: "-c . refresh.php";WorkingDir: "S:/wamp/scripts"; Flags: waituntilterminated
Action: run; FileName: "net"; Parameters: "start wampapache"; ShowCmd: hidden; Flags: waituntilterminated
Action: resetservices
Action: readconfig;
[switchPhp5.3.1] <<<----------PROBLEM CHILD-------- ...(FileName)------>>>
Action: service; Service: wampapache; ServiceAction: stop; Flags: ignoreerrors waituntilterminated
Action: run; FileName: "S:/wamp/bin/php/php5.2.6/php-win.exe";Parameters: "switchPhpVersion.php 5.3.1";WorkingDir: "S:/wamp/scripts"; Flags: waituntilterminated
Action: run; FileName: "S:/wamp/bin/php/php5.2.6/php-win.exe";Parameters: "-c . refresh.php";WorkingDir: "S:/wamp/scripts"; Flags: waituntilterminated
Action: run; FileName: "net"; Parameters: "start wampapache"; ShowCmd: hidden; Flags: waituntilterminated
Action: resetservices
Action: readconfig;
;WAMPPHPVERSIONEND
##############################################
Love is the Function, No Form is the Tool.