Is it wrong to hate web server configurations?
You might think after reading this I’m a web server expert, I’m far, far, far from a server expert, just happen to be very good at finding server tutorials written by others and following their instructions!
WAMPserver 2.5 had Apache 2.4.* and PHP 5.5.* and XAMPP had Apache 2.4.* and PHP 7.0.* : also have a live server running Apache 2.2.* and PHP 5.3.*, the live server is well overdue an update.
So I had three versions of PHP, but had to run three ‘systems’ to access them!
Why Use WAMPserver and/or XAMPP With Multiple PHP Versions?
I need multiple server configurations (different PHP versions in particular) for making sure any WordPress theme development (Stallion Responsive) and WordPress plugin development (Stallion SEO Plugin and WordPress SEO Comments Plugin) works under most server environments: can’t test everything.
For example in PHP 7.0.*, Stallion Responsive 8.4 has some PHP notices about using functions and classes with the same name. Perfectly valid PHP code in PHP 5.*, but PHP plans to depreciate the code in the future. It’s still valid code in PHP 7.0.*, but you get a PHP notice : basically warning you to fix it before they depreciate it. I’ve fixed these PHP 7.0.* notices in Stallion Responsive 8.5, but it required switching between WAMPserver 2.5 (running PHP 5) and XAMPP (running PHP 7) to check the code changes worked in PHP 5.* and PHP 7.* (a pain to manage!).
Problem was WAMPserver and XAMPP both run under Port :80. SKYPE runs under port :80 as well just to make things interesting :-). To test a theme/plugin required switching between the two localhost Windows servers (can’t run them at the same time due to the port :80 conflict) including copying whatever PHP files had been modified.
It was really annoying, so I had a tendency to develop only in WAMPserver and test in XAMPP near the end, and the live server at the very end.
Can mean if something messes up in an earlier/later version of PHP I might have made a few days worth of edits before realizing!
Time to find a better solution for testing.
WAMPserver has the ability to run multiple versions of Apache, MySQL and PHP, but until now I’d not tried (hard) to get it to work. In hindsight (after manually adding PHP 7.0.11) there’s a REALLY easy way to add extra versions of Apache, PHP and MySQL via WAMPserver 3 addons, you can find all the WAMPserver 3 addons at https://sourceforge.net/projects/wampserver/files/WampServer%203/WampServer%203.0.0/Addons/
Note: XAMPP appears** not to have a multiple PHP version, so limited for development in multiple environments.
** At the time of writing (October 2016) I’m running XAMPP Control Panel 3.2.2, my version of XAMPP is almost a year out of date. Based on https://www.apachefriends.org/download.html looks like you can only run one PHP version per install.
WAMPserver 3 Upgrade
WAMPserver is currently in version 3.0.6 (October 2016), but I’d not got around to upgrading it: upgrading servers always goes wrong. I bit the bullet and upgraded to WAMPserver version 3.0.6 (as expected I ran into issues, had to make manual edits) which resulted in having PHP 5 and PHP 7 in one program.
How to upgrade from WAMPserver 2.5 to WAMPserver 3.0.6 is described at: http://forum.wampserver.com/read.php?2,138295
First step is upgrade to WAMPserver 3.0.3.
I ran WAMPserver 2.5 x64, so downloaded the x64 file : https://sourceforge.net/projects/wampserver/files/WampServer%203/WampServer%203.0.0/Updates/wampserver2.5_x64_update_3.0.3.exe/download
If you run WAMPserver 2.5 x32 use the x32 file : https://sourceforge.net/projects/wampserver/files/WampServer%203/WampServer%203.0.0/Updates/wampserver2.5_x86_update_3.0.3.exe/download
I think I made a mistake, when updating I changed the directory to match my current directory “c:/wamp/” (it was going to be “c:/wamp64” – not sure if changing it was the right move?). After the upgrade the server stopped working, so had to modify a few config files (didn’t document what I modified).
Make sure you have the correct Visual C++ Packages installed, I was missing the x64 version required to run PHP 7. To check click the Windows “Start Button” >> “Control Panel” >> “Programs and Features” – this shows everything installed under Windows: I run Windows 7, didn’t like the look of Windows 10.
The above is after I installed the missing 2015 x64 Visual C++ Package: search Google for “Microsoft Visual C++ 2015” and you’ll find the latest file.
After WAMPserver 3.0.3 is working, upgrade to WAMPserver 3.0.6. The file below works for both x32 and x64 versions of WAMP : https://sourceforge.net/projects/wampserver/files/WampServer%203/WampServer%203.0.0/Updates/wampserver3_x86_x64_update3.0.6.exe/download
That got me up to date running WAMPserver 3.0.6 with a couple of versions of PHP 5.* (forget which) and PHP 7.0.3. Also had a couple of versions of Apache 2.4.* and MySQL 5.* available.
Running Multiple Versions of PHP
Time to celebrate, figured out how to configure WAMPserver 3.0.6 to run multiple instances of Apache and PHP (don’t need multiple version of MySQL). Under one install so I can quickly switch between different versions of PHP 5 and PHP 7 without copying PHP between WAMP and XAMPP, yeah :-)
It’s relatively easy to manually add new PHP versions. Note above, the WAMPserver addons link: the really easy way is use WAMPserver pre-compiled addons to add PHP 7.0.11 etc…
I downloaded a version of PHP from http://windows.php.net/download/ I’ve used the ones listed below because I installed the WAMP x64 version (probably not ideal in hindsight as PHP x64 is experimental). If you installed WAMP x32 download the x86 versions (I chose Thread Safe : not sure what that means).
VC14 x64 Thread Safe (2016-Sep-14 02:01:42) : http://windows.php.net/downloads/releases/php-7.0.11-Win32-VC14-x64.zip
VC11 x64 Thread Safe (2016-Sep-16 07:20:00) : http://windows.php.net/downloads/releases/php-5.6.26-Win32-VC11-x64.zip
Example of manually adding PHP 7.0.11 to WAMPserver (note there was already a WAMPserver addon for PHP 7.0.11, DOH!):
Unzipped the zip file “php-7.0.11-Win32-VC14-x64.zip” and renamed the folder from “php-7.0.11-Win32-VC14-x64” to “php7.0.11”.
Note: if you leave the – between php and 7 (php-7) the PHP version in WAMPserver (“Left Click” >> “PHP” >> “Version”) is listed as -7.0.11. Remove the – from the folder name to give 7.0.11 to match the other PHP versions format.
Move or copy the “php7.0.11” folder to your WAMPserver PHP folder. I have WAMP under “C:/wamp/” so moved the folder to “C:/wamp/bin/php/php7.0.11/”.
Next is copy two files from “C:/wamp/bin/php/php7.0.3/”. PHP 7.0.3 is bundled with WAMPserver 3, so the files are close to what we need without having to understand PHP settings :-)
Copy “phpForApache.ini” and “wampserver.conf” into “C:/wamp/bin/php/php7.0.11/”.
Edit “phpForApache.ini” and change all instances of “php7.0.3” with “php7.0.11” – when I did it there were 3 instances that needed changing. The final change was related to this code:
xdebug.remote_enable = off
xdebug.profiler_enable = off
xdebug.profiler_enable_trigger = Off
xdebug.profiler_output_name = cachegrind.out.%t.%p
PHP 7.0.11 didn’t have a “/zend_ext/” folder. I checked the “php.ini-development” file from the “/php7.0.11/” folder and it didn’t have the above code, so figured it wasn’t needed, so commented it all out (I was right, wasn’t needed).
Exit WAMPserver : “Right Click” the WAMPserver tray icon, click “Exit”, not “Left Click” >> “Restart Services”, you have to Exit WAMPserver and restart.
Run WAMPserver and check under “Left Click” >> “PHP” >> “Version” and “7.0.11” should be listed. Click “7.0.11” and PHP 7.0.11 should load.
Update: I installed PHP 5.4.23 as well and found Refreshing WAMPserver also ‘loads’ the new PHP versions: To Refresh WAMPserver “Right Click” the WAMPserver tray icon, click “Refresh”. No need to exit and restart, yeah.
You can also add multiple versions of Apache.
And multiple versions of MySQL.
I used a similar process for PHP 5.* versions, but used the “phpForApache.ini” and “wampserver.conf” files from the “php5.6.18” folder instead.
I wanted a version of PHP 5.3.* since quite a lot of servers still run PHP 5.3.*. Couldn’t find a compiled x64 version as a WAMPserver addon or on the main PHP website, so had to find one compiled by someone else: could compile PHP 5.3.* myself, but that sounds like hard work :-).
Found PHP 5.3.28 x64 at https://www.apachelounge.com/viewtopic.php?t=5702 (specifically http://phpdev.toolsforresearch.com/php-5.3.28-Win32-VC9-x64.zip ). Scanned it for viruses etc… no issues, worked with WAMPserver x64 v3.0.6 without issue.
Can currently test in PHP versions:
That should be more than enough to find any issues between various PHP versions.