How to Upgrade to Apache 2.2.10 with Windows XP
For weeks now I have had a persistent problem with my wishhh.com service. It was taking an inordinate amount of time to connect to the service (sometimes as much as 2 minutes or more). After ruling out every possible issue, I decided to upgrade my Apache server to the latest release (version 2.2.10). I’m delighted that the upgrade solved my problem.
I had installed Apache server three years also and made only a few changes to its configuration files since. Being a bit rusty, I searched for an online ‘how-to’ upgrade guide. The only guide I found was Evaria.com’s upgrade tutorial here. It was helpful but a little bit for my tastes. I followed that tutorial and took notes along the way. This post fleshes out the details a bit further.
Note: This post describes my upgrade from Apache version 2.0.54 to the latest version 2.2.10 (as of December 1, 2008). If you are upgrading from a different version, you’ll need to make adjustments to the instructions below to reflect your specific circumstance. If needed, you can view my server specs at the end of this post for.
Before you Begin
- Gather Your Info: Information on the latest version of Apache HTTP Server can be found here.
- Download the Package: Before de-installing your current version, be sure have the latest version at the ready. You can download it from one of the mirror sites linked into here. I downloaded this ‘Win32 Binary without crypto (no mod_ssl)’ .msi installation file was:
- Upgrade Info: Basic upgrade information can be found here. Unfortunately, I could not find step-by-step upgrade instructions on the apache.org site - hence this post.
- Needed PHP DLL: If your site uses PHP (all WordPress.org sites), for the upgrade to work you must first have installed a recent version of PHP. Before proceeding, make certain the following .dll is available in your php directory:
You’ll need it (see below). If it is not there, you’ll need to upgrade your PHP installation before upgrading to Apache 2.2.10. The latest PHP version 5.2.6 is available here).
- Create Restore Point: I strongly suggest creating a Windows XP restore point so you can recover back to your status if something goes wrong:
- All Programs
- System Tools
- System Restore
- Create a Restore Point
- Backup Your Prior Apache Installation: It’s always better to be safe than sorry. In my case I backed up everything in my old install directory, which was here:
c:\Program Files\Apache Group\Apache2
If you install the upgrade into a different directory (which I recommend – see installation instructions below) this step may not be necessary since an installation into another directory doesn’t delete or overwrite any of the old files during the upgrade process.
Removing Apache 2.0.54
It may not be necessary to completely de-install your old installation before installing the newest version. However that’s what they did in the avaria upgrade tutorial, so that’s what I did. Your on your own if you want to leave the old version installed (at a minimum you’ll need to remove the old one as an XP Service I should think).
- Stop Apache: Stop the currently running Apache server:
- Click on the Apache icon in the system tray to start the “Apache Service Monitor”
- Click the ‘Stop’ button.
- Uninstall The Current Version:
- Control Panel
- Add/Remove Programs
- Find and remove the currently installed Apache application
- Remove the prior Apache2 Service from Your Registry:
- Navigate to and delete all keys and subkeys from:
In my case this was not automatically removed by the un-install process.
- Reboot your Computer: When your computer restarts Apache should not be running. The Apache icon should no longer appear in the system tray.
- Check Services: Check to be sure the old Apache service is no longer listed as an installed XP Service:
- Control Panel
- Performance and Maintenance (only if you use Category view)
- Administrative Tools
If it is not there, you can move on and install the new version. If Apache is still listed as a Service, go back and make sure it was completely uninstalled and removed from the registry.
Installing Apache 2.2.10
- Run the Installation .msi File: Run the Apache installation .msi file that you downoladed above. Accept the Apache License and configure as follows:
- Network Domain: 127.0.0.1
- Sever Name: 127.0.0.1
- Administrator’s Email Address: Add whatever email address you want to use here. Make one up if you want. I did. I don’t know what this is for.
- Install for: check ‘for All Users, on Port 80, as a Service — Recommended’
- Setup Type: Typical
- Install Directory: Pick whatever you wish. The default is:
C:\Program Files\Apache Software Foundation\Apache2.2
I chose C:\Apache
Note: Choose anything other than the directory where your prior version was installed – those files are all still there in case you need to recover.
That’s it. The install is done.
- Test: At this point, before editing the config files or copying your htdocs files over, accessing your website through a browser should yield a triumphant: ‘It Works!’ If this doesn’t work straight away you may need to reboot first.
- Copy htdocs Directory: Copy the entire contents of the htdocs directory (and all its subdirectories) from your old install location to your new. The htdocs directory contains all your actual html web pages, PHP files, scripts, .htaccess files etc. In my case I copied all the files in:
C:\Program Files\Apache Group\Apache2\htdocs\
This may be the end of your installation if you are running a simple site.
- Edit Config/ini Files: For more complex setups you’ll probably need to edit your httpd.conf file and, if you are running PHP, you may need to update your php.ini file. See sections below.
Editing the Apache ‘httpd.conf’ File
The rather limited Apache 2.2 upgrade instructions (here) suggest that you can use the same httpd.conf file if you are upgrading from version 2.0 or later. This is probably true if you installed Apache into the same directory as your old install. I chose not to do this for two reasons:
- I installed the upgrade in a different directory and didn’t want to have to go through the old httpd.conf file and edit all the directory references in the file; and
- I wanted whatever efficiencies the new and much shorter v 2.2 ‘simplified’ httpd.conf file could give me.
If you use the new file as I did, you’ll need to make whatever customizations to that configuration file that you made to your old httpd.conf file. My suggestion is that you open your old httpd.conf file beside your new httpd.conf file and go through them line by line to make sure you carry over all the needed customizations.
In my case, the customizations I needed to make to my new http.conf file were as follows:
- mod_rewrite: I uncommented out the following line:
LoadModule rewrite_module modules/mod_rewrite.so
This is critical for WordPress and most other PHP-based site.
- PHP LoadModule: Add the following line to your LoadModule section:
LoadModule php5_module C:/<path>/php5apache2_2.dll where <path> is the path to your php directory containing that .dll file. See the ‘Before you Begin’ section above.
AllowOverride: For reason’s specific to my site (including WordPress redirect needs) my AllowOverride directive is customized as follows:
AllowOverride limit indexes Fileinfo
AddType: In order for PHP to work with Apache, the following additional AddType directives are needed:
AddType application/x-httpd-php .php. phtml
AddType application/x-php-source .phps
where <path> is the path to your php directory.
Virtual Hosts: In Apache 2.2, the entire Part 3 of the httpd.conf file (the part where virtual hosts are set up) was removed. This is fine if you run only one domain/website on your server. I currently run four domains/websites on my server. I appended the entirety of Part 3 from my prior httpd.conf file to the end of the new httpd.conf file. It worked without any changes.
Note: Part 3 of the old httpd.conf file is now contained in the \extra\httpd-vhosts.conf file. It can be copied into your httpd.conf file and edited as necessary if you don’t want to copy the info over from your old .conf file.
Editing PHP ‘php.ini’ File
Since Apache is now installed in a different directory, one last change is required in the php.ini file:
- doc_root: The doc_root line needs to be changed to reflect the location of your new Apache installation. In my case I changed it to:
doc_root = C:\Apache\htdocs
from the previous:
doc_root = C:\Program Files\Apache Group\Apache2\htdocs
Note: Of course, if installed the new Apache in the old Apache directory, you won’t need to make this change.
- Deleting Old Files: Once you are certain that everything is up and running, and your htdocs directory has been successfully moved (or copied) from the old installation directory to the new, you can delete all the Apache files and directories in the old Apache directory structure – especially if you have made a backup. But, I strongly recommend leaving the old files in place for a couple weeks until you are absolutely certain everything is running with your new setup. Should you need to recover to your old installation, you’ll want the old directory still in place if you use the Windows restore point you set.
My Server Specs
For your reference, here’s what my server specs where at the time of this upgrade:
- Apache Upgrade from v. 2.0.54 to 2.2.10: This post described my upgrade from Apache version 2.0.54 to the latest (as of December 1, 2008) version 2.2.10.
- Windows XP SP3: I run a bare-bones version of Windows XP, Service Pack 3.
- PHP v. 5.2.3: Not the latest version. The latest is v. 5.2.6. The next time I upgrade PHP I’ll write a similar post.
- MySQL v. 4.0.15: Also, not the latest version. The latest is v. 5.1. Version 6 in is alpha. I plan to upgrade to version v. 6.0 once it is in general release.
- WordPress 2.6.1: All my blogs run on WordPress 2.6.1. I will be updating to version 2.7 as soon as its out (expected any day now).
- Cheap Dell: This is all running in my home office on the cheapest Dell PC I could purchase a few years ago for about $600.