In my last blog post, I said that I like having a development environment on my computer (running Windows 7). I use WampServer to do this. I especially like that WampServer allows you to have multiple versions of php (and MySQL and Apache) installed. You can switch between versions in the WampServer menu on the icon in the system tray.
The server that an upcoming client project will be hosted on will be running php version 5.2.14. That version isn’t available for download on the WampServer website, but that doesn’t mean that I’m out of luck. I decided to manually install php to see if I could get it running, and I succeeded. I wanted to share my process so that you can do it to (and so that I know what I need to do if I have to install another version that isn’t available on WampServer).
Download the php windows binaries
There are 2 sources for the binaries, php.net and windows.php.net. I recommend downloading the files from windows.php.net because they are more up-to-date. I ran into an issue where the cURL extension wouldn’t load. It turns out the php team made some changes to the php_curl.dll file to correct those issues. The download on php.net doesn’t include those changes (it’s an older version).
No matter which source you choose to download the binaries from, download the zip package. Extract the contents of the zip file to C:\wamp\bin\php\php5.2.14 (change the path to reflect where you have WampServer installed and the version number to whatever version you are installing).
Modify the php.ini file
You need to make some changes to the php.ini file in order for it to work with WampServer. NOTE: You will need to modify the paths to reflect where your installation of WampServer is (mine is in C:\wamp). You will also have to modify the extension_dir if you are installing a version other than 5.2.14. The following lines indicate the changes you will need to make. Just do a search to find where in the file the lines are so you can make the changes (I noticed that the line numbers vary between php versions, so I didn’t include them here).
; Log errors to specified file.
error_log = c:/wamp/logs/php_error.log
; Directory in which the loadable extensions (modules) reside.
extension_dir = "c:/wamp/bin/php/php5.2.14/ext/"
; Temporary directory for HTTP uploaded files (will use system default if not
; specified).
upload_tmp_dir = "c:/wamp/tmp"
; where MODE is the octal representation of the mode. Note that this
; does not overwrite the process's umask.
session.save_path = "c:/wamp/tmp"
You will also want to enable/disable any extensions that you need for your application(s).
Once you have completed your changes to the php.ini file, you will need to save a copy of the file with the filename of phpForApache.ini (in the same directory as the php.ini file). You must do this in order for WampServer to use the new version. WampServer copies this file to the Apache server when you select the version from the menu.
Modify the WampServer configuration
If you already have WampServer running with another version of php, copy the wampserver.conf file from that version into your newly installed version. If you don’t have another version running, paste the following code into a file and save it in the directory that you extracted the php files to.
<?php
$phpConf['phpIniDir'] = '.';
$phpConf['phpExeDir'] = '.';
$phpConf['phpConfFile'] = 'php.ini';
$phpConf['apache']['1.3']['LoadModuleName'] = 'php5_module';
$phpConf['apache']['1.3']['LoadModuleFile'] = 'php5apache.dll';
$phpConf['apache']['1.3']['AddModule'] =Â 'mod_php5.c';
$phpConf['apache']['2.0']['LoadModuleName'] = 'php5_module';
$phpConf['apache']['2.0']['LoadModuleFile'] = 'php5apache2.dll';
$phpConf['apache']['2.0']['AddModule'] =Â '';
$phpConf['apache']['2.2']['LoadModuleName'] = 'php5_module';
$phpConf['apache']['2.2']['LoadModuleFile'] = 'php5apache2_2.dll';
$phpConf['apache']['2.2']['AddModule'] =Â '';
?>
You will also need to make some changes to the C:\wamp\wampmanager.ini file so that you will be able to switch to the version you are installing.
In the [phpVersion] section (line 335) add the following (change the version number to reflect your version):
Type: item; Caption: "5.2.14"; Action: multi; Actions:switchPhp5.2.14
At the end of the section (before ;WAMPPHPVERSIONEND), add the following code (again, change the version number to reflect your version):
[switchPhp5.2.14]
Action: service; Service: wampapache; ServiceAction: stop; Flags: ignoreerrors waituntilterminated
Action: run; FileName: "c:/wamp/bin/php/php5.3.0/php-win.exe";Parameters: "switchPhpVersion.php 5.2.14";WorkingDir: "c:/wamp/scripts"; Flags: waituntilterminated
Action: run; FileName: "c:/wamp/bin/php/php5.3.0/php-win.exe";Parameters: "-c . refresh.php";WorkingDir: "c:/wamp/scripts"; Flags: waituntilterminated
Action: run; FileName: "net"; Parameters: "start wampapache"; ShowCmd: hidden; Flags: waituntilterminated
Action: resetservices
Action: readconfig;
Restart the server and verify
After you have made and saved these changes, exit out of WampServer and restart it. Once it is back up and running, switch to your newly installed version of php. You can do this in the menu (see screenshot). Your final step should be to set up a phpinfo page and verify that the newly installed version of php is running and has all of the extensions enabled that you need.
That’s it. It’s as simple as that (I did all the hard work for you). You can now start developing your php application.









8 Comments
Thanks so much for this very detailed instructions, Becky! I had no idea about what to do to add PHP 5.2.14 to my WAMP Server 2 installation!
The only odd thing I had to deal with is that every time I restarted WAMP it was resetting the wampmanager.ini file to its original content! Finally I had to put a Read Only attribute on this file and that’s how I got WAMP to show me the added PHP version.
Thanks again!
Thanks Becky… I’m so in the beginning of using wampserver2 but your instruction were what I need to resolve running php 5.2.14 in my laptop
Since my alive server has
Apache 1.3.33
php 5.2.14 (that’s how I got into this page)
MySQL 5
And I would like to simulated as close as posible I was trying to use an 1.3.35 wampserver apache addon, but it seem that under windows vista home premium it’s imposible, Apache versions 2.0 and 2.2 work fine
Any sugestion?
I am having problems modifying the wampmanager.ini file, the wampmanager.tpl file parses the ini file. so when I make the changes in the ini file, they immediately revert back upon launch of wamp server. Would LOVE advice. Thanks!
I’ve followed these instructions verbatim 4x now, and I have the same result every time. I can select 5.2.14 from the PHP dropdown, but the version isn’t installing for some reason.
The desk tray icon is 2/3 yellow.
Any recommendations are greatly appreciated.
DG
Thanks for this! It still works for the latest WampServer as I just used it to manually install PHP 5.2.17 for testing purposes.
DD
The desk tray icon is 2/3 yellow. My php version is 5.2.17.
Any help is appreciated.
Becky – Excellent. Any idea if this works for MySQL also via the ZIP? I am sure the configuration you outlined will but not if WAMP will still work properly. Guess I will find out :)
TO: Guillermo – I had the same issue with wampmanager.ini getting re-written to it’s original state no matter my attempts to rectify the situation, e.g, restarting WAMP and my PC.
So, I renamed wampmanager.ini to wampmgr.ini and modified \wamp\scripts\config.inc.php to reflect the change. ( i.e., $wampserverIniFile = ‘../wampmgr.ini’; )
I did this because I wanted the WAMP tray menu to get updated [ I.E. a checkmark (Glyph: 13 in the ini) appear by the current version after switching versions. ] However, I noticed the tray menu was not getting updated even though the wampmgr.ini reflected the switch.
I changed back to wampmanager.ini and now everything works as expected. Yes, wampmanager.ini is re-written at startup but my changes aren’t lost. Very strange but acceptable.