Installing Apache 2.0.59 to a Windows-based computer, locally: Part 1

In a previous article, I described how to install Apache 1.3.34 to an average home computer, running Windows XP. Since then, only Apache 1.3.35 has been released that would allow me to update my guide, even though the current 1.3.x version is 1.3.37. There's also a desire on my part to use Apache 2.0, even though my host has not yet begun using them.

For that reason, I'll be walking through a second installation of Apache on a home computer, so that both Apache 1.3.x and Apache 2.0.x can run together (if not at the same time, then at least switchable, as I detailed how to do with PHP).

The environment I’ll be using is as follows.

HP Pavilion a620n
2.20 Ghz, 960 MB (1 GB) of RAM
Windows XP Home, SP2

Why would I want to run both Apache 1.3.x and Apache 2.0.x?

You may not. In this case, you may simply want to remove Apache 1.3.x (make sure you backup your configuration files, first) and just install Apache 2.0.x. However, since my host uses Apache 1.3.x, I still need to have an older version that I can do testing on. In addition, since I want to write code that can be run on either Apache 1.3 or 2.0, I'll want to be able to switch between the two for testing purposes. I suppose it's the same reason I have both ColdFusion 6.1 and 7.0 on my machine.

Downloading Apache

The first thing to do is to download Apache 2.0 from While we could download and run Apache 2.2, I'd much rather install 2.0, since it's still being developed, and is probably the step most Apache 1.3.x hosts will take next (other than simply upgrading to a higher 1.3 release).

Since we're installing to Windows, we want to download the file apache_2.0.59-win32-x86-no_ssl.msi. This file is under 4.5 MB in size. If you've been installing other software with me, then you'll want to download this to the same location as your other server-related downloads.

By the way, if you haven't been following along, or it's been a while since you have, you may want to review the 'Initial steps before installation area in my Apache 1.3.34 install guide, as there's a number of steps you should do while you're waiting for the download to complete (update your anti-virus software, defragment your hard drive, and determine where you want your site to reside).

Once the download has finished, and you've reviewed these steps, as necessary, it's time to start the installation.

Installing Apache 2.0.59

The first thing we want to do is temporarily stop Apache 1.3.x, if it's running, and backup the httpd.conf file. Next, start the installer.

It's pretty straightforward for the first two screens, but the third screen contains some information to read over. Eventually, you'll hit the Server Information screen. We're only going to run this on localhost, so we'll use that for the first two fields. Put your real email into the third field, and make sure that you're running Apache as a service for all users, on Port 80.

On the next screen, you can do either a Typical or a Custom install. Select Custom, so we know what is being installed where. First, you'll determine where Apache is installed. If you click on Apache HTTP Server 2.0.59, you'll see that the default location is C:\Program Files\Apache Group\. For the sub items, however, the location is C:\Program Files\Apache Group\Apache2\, which is exactly how we want things to be installed. After all, we don't want to lose our Apache 1.x installation.

That's the only item, so hit Install.

If you're using Windows XP SP2, you'll probably get prompted on whether you want to block Apache HTTP Server. Unblock this, since you do want the server to run.

Other than that, you'll see that the Installation Wizard has completed, and Apache will be up and running. You can confirm this by checking the running Services, or by looking in your Start panel, where you'll see the Apache feather near the time. You can also go to http://localhost/ and see what comes up.

Setting up startup types

If you don't have two instances of Apache installed, then you may still want to read this section for the Services Monitor discussion.

Now that you've got both Apache 1.3.x and Apache 2.0.x installed, you've got a problem. Unless you changed Apache 1.3.x's startup type, it will automatically be starting with Windows. But, so too will Apache 2.0.x. We'll need to fix this by going to the Services panel, and changing the startup types so that either one or neither startup with Windows.

To get to the Services panel, you can either go through the Control Panel in Windows, the Start Menu, through a shortcut or MMC that you've setup, or through the Apache Services Monitor. Let's go through the Apache Services Monitor.

You can open this by either using the item in your Start bar. Since you have both Apache and Apache 2, both will show up as Services. However, Apache will have a red dot, and Apache2 a green one.

Here we can start, stop, or restart a service. We can also open up the Windows Services panel by clicking on the Services button. For now, let's do that.

We now have to determine which service we want to run at startup, or if we'd rather neither start. If you would rather that Apache 1.3.x start, then either double-click,, or right-click and select Properties, Apache2 and change Startup type to Manual. On the other hand, if you want Apache 2.0.x to start, do the same for the Apache service. If you don't want either one to start, then change the types for both to Manual.

If you wanted to, you could let both run at the same time. The only thing you would need to do is have one listen to one port, and the other listen to another. We setup the configuration file in a bit, we'll go over how to change the ports.

Setting up the Apache 2.0.59 configuration file

For now, stop both Apache and Apache2, if either is running, as we'll be setting up the necessary configuration file for Apache 2.0.59.

First find the file at C:\Program Files\Apache Group\Apache2\conf\httpd.conf and make a copy of it, making note in the new file name that this is an original. Now, open the httpd.conf file with Notepad. Note that you can also open this file using the Start menu, but since we're making a backup copy, it makes sense to go directly to it.

At this point you'll need to know where you're storing your Web files. I decided to install them directly into a folder off of the c drive, so I store my files in C:\home\, with a directory for each site, as necessary.

Do a search first for DocumentRoot. Following the standard given, change this to the folder where you are storing your files. So, in my example, this line was changed from

DocumentRoot "C:/Program Files/Apache Group/Apache2/htdocs"


DocumentRoot "c:/home"

Scroll down a little and you'll see the following line

<Directory "C:/Program Files/Apache Group/Apache2/htdocs">

which should also be changed to match what you used for DocumentRoot.

If you scroll up a little bit, you'll see a line that is as follows.

Port 80

This is where you can change what port Apache2 should listen to. If you really want to, you can change this, otherwise I'd just as soon recommend that you just run Apache or Apache2, but not at the same time. Since you're installing to a home computer, you don't really need to be running both at the same time. Besides, we can write a batch file which will automate the stopping and starting procedure for you, with one click (I'll detail this below).

For now, Start Apache2 (or if you didn't listen to me above, restart Apache2). Note that if you go to http://localhost/ before you do this, you'll either go nowhere, or to the old DocumentRoot, depending upon whether you'll be starting or restarting Apache2. Changes to the httpd.conf file only take once Apache is restarted.

Once you start Apache2 and go back to http://localhost/, you'll find that you do go to the correct directory. Horray!

Moving along ...

At this point, things get a little tricky. Depending upon how many of my guides you've followed, you'll need any of the following functionality added to Apache 2.0.59;

  • Perl
  • PHP (4 and/or 5)
  • MySQL
  • ColdFusion (6.1 and/or 7.0)
  • PostgreSQL

There's also subdomains that you may have setup that will need to be re-setup.

Below, I'll detail how to do each of these steps. You can then select whatever applies to you. All we really have to do is setup Apache 2.0.59 to recognize the functionality above, since we've already installed them once for Apache 1.3.x. However, it's also possible that you'll want to install some of these for the first time, using Apache 2.0.x instead of Apache 1.3.x.

In that case, you can either wait for me to go over it (which I do plan on doing) or take a look at both the original guide working with Apache 1.3.x and the steps I setup below to get Apache 2.0.x working. You can also email me personally, or post a comment on this article, or the previous articles. Either way I should get back to you with some kind of answer.

First, however, we'll setup the batch file that I mentioned above. Then we'll go over each of the above implementations.

Creating a batch file to switch between Apache and Apache2

As I stated above, we can either have Apache and Apache2 listen to both ports, or simply have one run at a time. To make switching easier, we can write a Windows batch file that will allow us to stop one version of Apache and start the other, with just a couple actions.

In a previous guide, we mentioned how to create a batch file that would restart Apache.

net stop “Apache”
net start “Apache”

Now, we'll create a script that will start Apache, and stop Apache2, if it's running.

net stop “Apache”
net stop “Apache2”
net start “Apache”

We want to stop both, just in case either one is running. We can then start Apache back up.

To start Apache2, and stop Apache, we just change that last line.

net stop “Apache”
net stop “Apache2”
net start “Apache2”

And with that, we've got the makings of two batch files that we can run.

Open Notepad and copy and paste the first block of three lines into it. Now, save this as something like _Apache_start1.bat. In a new file, copy and paste the second block of three lines into it, and call this one something like _Apache_start2.bat.

Now make sure these are where you can get to them easily, and run either one. Check either the Apache Services Monitor or the Services panel to verify that the batch file ran correctly. Navigating to http://localhost/ should display correctly as well.

With this new script in place, you can now delete any old 'restart Apache' batch files you may have had, since you've now got a new, better, one. Of course, if you do opt to remove either Apache or Apache2, you'll want to remove the respective line from these files, since one less line is one less process (which will be a wasted process).

You've now got two files that you can easily run to switch between Apache 1.3.x and Apache 2.0.x. In the later sections, we'll write a number of other batch files that we can run for similar effects.

The Perl installation

At this point, you've probably already got ActivePerl installed (but if you don't, time to check out the first four paragraphs in the previous guide covering the ActivePerl installation).

Now that you've got ActivePerl installed, we're going to hook it up with Apache 2.

Head-over to the location of the httpd.conf file (C:\Program Files\Apache Group\Apache2\conf\ if you've been following along) and make a backup copy. You've already made an original backup, so perhaps call this one httpd_basicsetup.conf (or whatever makes sense to you). Once the backup has been made, open up the httpd.conf file with Notepad.

Next, do a search for ExecCGI, and scroll down to the first uncommented line.

Options Indexes FollowSymLinks

Add two words to the end of this, so that the line reads as follows.

Options Indexes FollowSymLinks ExecCGI Includes

Next, do a search for cgi-script, which should place you in the following line.

#AddHandler cgi-script .cgi

Simply remove the pound sign and add .pl at the end of the line to continue. Likewise, remove the pound sign from the following two lines as well, which are just a handful of lines further down.

#AddType text/html .shtml
#AddOutputFilter INCLUDES .shtml

Finally, find the following line and add a pound sign in front of it (to comment it out).

ScriptAlias /cgi-bin/ "C:/Program Files/Apache Group/Apache2/cgi-bin/"

This will allow you to run CGI scripts from any folder, and not just this one.

Now that we've made these changes, save the httpd.conf file and restart Apache 2.

If you now go to http://localhost/, your DocumentRoot content should display. Next, open up a new Notepad file and add the following text.

print "Content-type:text/html\n\n";
print "Hello world!";

Save this into your DocumentRoot folder (for example, c:\home\ if you've been following along) and call it something like TestCGI.cgi. If you hit this page, http://localhost/TestCGI.cgi, the page should load with the text of “Hello world!”.

With the installation complete, you'll want to close the httpd.conf file and then make a copy of it, calling it something like httpd_perl.conf.

Now you've got Perl hooked-up, so you can continue on with the additional components you need to add.

The mod_perl installation

Unfortunately, with the mod_perl installation, we're actually going to have to download a file from the Internet, since the mod_perl for Apache 1.x is not the same as the one for Apache 2.x.

Head over to and select the “Download” link. Next, select the “Binary mod_perl distributions” link, and Win32 Active Perl under 'How to get pre-compiled mod_perl 1.0'. The linked to paragraph actually includes a link to the mod_perl 2.0 ppm, which eventually leads us to

Scroll to the bottom of the page and find the file. FYI, the file is for Apache 1.x, the file is for Apache 2.2.x, and this file,, is for Apache 2.0.x. Download this file (Save as) to your standard server downloads folder (for example, c:\home\downloads\).

We'll install this file in just a couple of steps. First, open up the Services panel, if it's not already started. If you click on Apache2, you'll probably see a description of 'Apache/2.0.59 (Win32)'. If you have Apache installed, click on Apache and see what the description is. This will be another way to determine whether our mod_perl installation has been successful.

Copy the file into the modules folder under Apache2 (C:\Program Files\Apache Group\Apache2\modules\).

Next, go up to the conf folder and make sure that you've got a recent backup of httpd.conf. Finally, open httpd.conf up and get ready for some editing.

The httpd.conf file updates are pretty easy. First, do a search for mod_foo. At the end of the LoadModule lines, add the following.

LoadFile "c:/usr/bin/perl58.dll"
LoadModule perl_module modules/

Note that if perl58.dll (from ActivePerl) is in a different location, change this location.

If you've followed by Perl guidelines, then you can skip the next step. Otherwise, search for cgi-script and add .pl to that line so that it reads as follows. Note, you may need to uncomment this line as well.

AddHandler cgi-script .cgi .pl

Save httpd.conf and restart Apache2. The description should show that you've correctly setup mod_perl.

If you've successfully installed mod_perl, then backup your httpd.conf file (as httpd_mod_perl.conf, for example). And with that, you're ready to move on.

In the next part ...

In part two, we'll be covering PHP 4 and 5, as well as ColdFusion MX 6.1 and 7. We'll also be going over MySQL and PostgreSQL.

View all of the steps to creating a local Web server, for development.