Upgrading Apache 2.2.x to 2.2.23 and PHP from 5.2 to 5.4 on Windows Server 2003+ (Win32)
I recently decided to upgrade both my Apache and PHP installs so I can take advantage of some of the new features of PHP 5.4. What I assumed would be a simple, well documented update, turned into hours of frustration and research. In the end, I was successfully able to perform the upgrade and hopefully this quick guide will save others from the same frustrating research.
Before beginning this upgrade, I assume you have the following installed and working: Windows Server 2003 (or later) x86, Apache 2.2.x, PHP 5.2.x
Step 1
Be sure that you have downloaded and installed the Visual C++ 2010 and Visual C++ 2008 Redistributable Package x86
http://www.microsoft.com/en-us/download/details.aspx?id=5582
http://www.microsoft.com/en-us/download/details.aspx?id=8328
Step 2
Download VC9 version of Apache 2.2.2x – Apache 2.2.2x Win32 – Same as the Win32 VC10, but build with VC9 x86
[Apache VC9 Binary] httpd-2.2.25-win32-ssl_0.9.8-VC9.zip from http://www.apachelounge.com/download/additional/
Step 3
Extract the Apache zip into a temporary folder and create a backup of your current Apache install.
Step 4
Stop the Apache service and replace the following directories in your Apache path with the ones from the extracted zip file:
1 2 3 4 5 |
-bin -lib -include -manual -modules |
Step 5
Start the Apache service and ensure that it works.
Step 6
Download the VC9 x86 Thread Safe version of PHP 5.4 from: http://windows.php.net/download
Step 7
Extract PHP into a different folder than the current version of PHP you are running. I used E:/PHP5.4/
Step 8
Make whatever changes you need to the included php.ini-production file and rename it to php.ini
Step 9
Change your Apache conf file to reflect the new PHP installation.
My settings:
1 2 3 4 5 6 7 8 |
################################################# # PHP 5 Configuration LoadModule php5_module "e:/PHP5.4/php5apache2_2.dll" AddType application/x-httpd-php .php # configure the path to php.ini PHPIniDir "E:/PHP5.4" |
Step 10
Restart the Apache service and you should be good to go.
Step 11 (Optional – If you plan on using Composer or PHP CLI)
To access the new version of PHP from the command prompt you must update the Windows PATH entry.
- Go to Control Panel and open the System icon (Start -> Settings -> Control Panel -> System, or just Start -> Control Panel -> System for Windows XP/2003)
- Go to the Advanced tab
- Click on the ‘Environment Variables’ button
- Look into the ‘System Variables’ pane
- Find the Path entry (you may need to scroll to find it)
- Double click on the Path entry
- Find the PHP directory and modify it to your new installation directory. (eg. E:\PHP5.4)
- Press OK and restart your computer