My goal would be to run a single webserver and add an entry in the VirtualHost entry to indicate if it should use PHP 5.2.9 or PHP 5.3. These virtual hosts should be able to run on the same port.
It should be noted that currently I use XAMPP for my development, and I'm currently using the one that distributes PHP 5.2.9 (1.7.1, I think).
I had a look around, and it looked like FastCGI could have been a solution. But then I came across this article on FastCGI and PHP 5 on Windows. I had enough troubles with an unstable server when running Xdebug. I didn't fancy inviting more trouble by running non-thread safe PHP, just to get FastCGI working.
I did try doing a few stupid things by just using the LoadFile, LoadModule and PHPINIDir directives the VirtualHost that I wanted to run PHP5.3. However, since the php5_module was already loaded, Apache just skipped over those settings.
In the end, I came across this article at Flow3. In short, you install PHP 5.3 beside your PHP5.2.9 installation, and copy the apache/conf directory to make a apache/conf-php5.3 directory and install it as a separate service that runs on its own port. It wasn't quite what I was looking for, but it will have to do for the moment.
Some points I picked up on:
- Make sure you change all ports and Listen commands. I have extra ports for SSL virtual hosts. Make sure you remember to change these not to conflict with the original port allocations.
- Copy the extra/httpd-xampp.conf from the 1.7.2 distribution into your conf-php5.3 area. XAMPP had radically changed how they want to setup PHP 5.3 in XAMPP 1.7.2, so you may as well go with the flow. I ended up commenting out their new security stuff at the base of the file, because Apache didnt like the IP addresses there. I'm only running a development environment, so I'm not too concerned with this.
- Create a php5.3/modules directory and copy php5apache2_2.dll and php5apache2_2_filter.dll from apache/modules into it, and alter the LoadModule php5_module to hardcode the directory location.
- Update the conf-php5.3/extra/httpd-ssl.conf file to point the logs to logs-php5.3. You may as well leave the conf directories where they are, so they can share the security certificates with your PHP5.2.9 installation. Unless you want them to be different.
- Because I've installed the PHP5.3 apache as a new service, it's available in the Apache Monitor for restarting.
So far, I've only done enough to get a simple phpinfo() displaying on a virtual host. I'm sure I'll come across a few other things, like needing extra drivers for my MS SQL datasources (yeah, some projects require those).
The plus side is that I can just swap port 80 for port 81, and see how some of the sites hold up under PHP 5.3. It's just a pity that most hosted environments I have to deploy to are still using PHP 5.2.X or older.
I have seen other instructions around that do things like a whole separate installation of XAMPP, and a few tricks to make the new installation of MySQL point to the existing datastores. Usually it just involves copying around the root and pma passwords. I may end up going down this route, to save my sanity, and migrate each project from the old XAMPP installation to the newer one as conversions are done.
As a minor rant against XAMPP, I think it's shitty that they include PHP5.3 in the bundle, and only give it a minor point release. PHP5.3 has enough changes to make it a pretty big deal, and should have warranted a major XAMPP point release, like 1.8. XAMPP should also continue to release minor releases that support PHP 5.2.X and any bug fixes for Apache 2.2 and MySQL under the 1.7.X release. However, XAMPP is a convenience service that I don't have to pay anything for, so I shouldn't complain too much.
FTR, at the time of writing, the latest releases of PHP are 5.2.12 and 5.3.1. I should probably update my XAMPP installs with those anyway.