How to Install the Apache Web Server on Windows

Set up and configure a local server to test your Perl/PHP Scripts and Pages


How to Install the Apache Web Server 1.x on Windows 9x and XP

by Christopher Heng, thesitewizard.com

Even though my "live" websites, like thesitewizard.com, are located on third party web hosts, I maintain an Apache web server on my Windows machine. Why?

  1. I find it very inconvenient to have to go online just to test and debug my PHP scripts. If you write CGI and PHP scripts, you might be in the same boat.

  2. Although I do have Apache and PHP installed in my Linux box, it is a real hassle to keep having to reboot in order to test my scripts, since I spend most of my time in Windows.

If you are facing a similar situation, or want to set up Apache in Windows for some other reason, you might find the information here useful.

Important: Note that this article deals with the setting up of Apache 1.x on Windows. If you are looking for information on how to set up Apache 2 on Windows, please see my other article How to Install and Configure Apache 2 on Windows instead. And if you use Windows Vista, please read the How to Install Apache 2.2 on Windows Vista tutorial. Vista requires different steps for a successful installation.

Windows 95 Preliminaries

If you are using Windows 95 (whether the original release or OSR1, OSR2, 2.1 or 2.5), you will need to install Winsock 2 first. (Skip this section if you're using a later version of Windows).

Get both WS2SETUP.EXE (Winsock 2) and the Y2K fix for that (Y2KVDHCP.EXE) from the Windows 95 download page on Microsoft's website.

Go to the link for the Y2K fix for Winsock 2 and DUN 1.3 (or later) and follow it. It'll lead you to a page with both the fix as well as the complete Winsock 2 package.

Note that Winsock 2 requires you to have DCOM version 812 or higher installed. If you don't have that, download it (free of charge) from Microsoft and install it.

If, like me, you hate to install anything on your Windows machine that will affect the fragile balance it currently operates under, here are some (hopefully) reassuring news:

  1. You do not have to install DUN 1.3 just to install Winsock 2. The two are separate. The Y2K fix listed above will not install any DUN 1.3 if you do not currently have it. (DUN 1.3 has been reported to cause problems on a number of Windows 95 machines.)

  2. Winsock 2 can apparently be uninstalled, and your original Winsock 1.1 will be restored. Your old Winsock files are copied to C:\WINDOWS\WS2BAKUP together with a batch file named WS2BAKUP.BAT which can be used to restore your Winsock 1.1 if your upgrade fails for some reason.

Windows 95/98/ME Notes

If you are thinking of allowing others on the Internet to access your web server while it is running on Windows 95/98/ME, think again. The operating system is not secure, and opening your system to the world is asking for trouble.

If you really need to go "live", my suggestion is to install Linux into another partition (or disk) and read up on how to tightened your security and run your Apache server from there. Linux, by the way, is free.

Installing Apache

Precompiled executables, complete with a Setup program, of the Apache server are available from the Apache website.

  1. Download and run it to get the server copied onto your machine.

  2. During installation, a dialog box will appear asking you for your domain name and server name. Simply enter "localhost" for both. Enter whatever email address you wish for the email address field. The installer uses these values to create a default Apache configuration file for you. Choose also to install Apache with shortcuts to start it as a service for all users.

  3. Under Windows XP, when you finish installing Apache, the installer will automatically start up the Apache service. To stop it and only start it manually when you need to use it for testing, go to Control Panel > Administrative Tools > Services, look for the Apache service and double-click it. From here you can stop the service and change the startup type to "Manual". The Apache service will then terminate and only start when you return to this control panel applet to manually start it. This is useful if, like me, you're only using the server to test your scripts, and don't want the server running all the time. Note that you will have to restart the service every time you make a configuration change.

  4. If your version of Apache does not create a shortcut in the Programs menu that allow you to start the Apache server. Simply navigate to "c:\Program Files\Apache Group\Apache\" and double click on Apache.exe to start the server. To terminate the server, select "Close" from the window's system menu.

  5. If you change your mind about the server name you chose when you installed Apache, you can always change it with your favourite text editor (such as Notepad from your Start menu | Programs | Accessories | Notepad) by searching for and replacing the following line in the "C:\Program Files\Apache Group\Apache\conf\httpd.conf" file.

    ServerName localhost

  6. If you want your server to handle Server Side Includes (SSI), use a text editor (like Notepad) to open "C:\Program Files\Apache Group\Apache\conf\httpd.conf". Search for "server-parsed HTML files" in the file, and add the following lines (or uncomment the example lines in the configuration file by removing the prefixed hash marks, "#").

    AddType text/html .shtml
    AddHandler server-parsed .shtml

    If you want "index.shtml" to be your default start page for your directories, ie, if you want Apache to load "index.shtml" when you type "localhost" or "localhost/directory/", you will need to search for a line in your "httpd.conf" that begins with "DirectoryIndex" and modify it as follows:

    DirectoryIndex index.shtml index.html

    Apache will now look for index.shtml first when it is given a directory without a file name, and only try index.html if index.shtml is missing.

  7. Close the Apache window and restart it. You have to do this every time you make a configuration change so that Apache will reload the modified configuration file.

  8. If you're using Internet Explorer, Firefox or Opera, you can test that you've properly installed and configured Apache by typing "localhost" or its IP address "127.0.0.1" into the location bar of the browser. You should see the default page installed by the Apache installer on your hard disk. It is located in "C:\Program Files\Apache Group\Apache\htdocs\". I have not been able to get earlier versions of IE and Netscape 4.73 to connect without the Dial-Up Networking dialog box popping up and insisting that I connect to my ISP (defeating the entire purpose of this exercise for me).

  9. If you can't get your browser to connect to your local webserver, you can still test it by manually mimicking a browser. Go to the Start menu and select "Run". A dialog box will appear. Type "telnet localhost 80" (without the quotes) into the dialog box and click OK. The Windows telnet program will start up. Go to the Terminal | Preferences dialog box and make sure that the "Local echo" check box is selected (unless you are one of those who like to type blind). Type "get / http/1.0" (without the quotes) into the telnet window followed by hitting the Enter key twice. You will get a whole lot of text scrolling swiftly by. This is the default page installed by the Apache installer on your hard disk. If you can get this it means that you've successfully installed Apache.

Where to Go From Here?

  1. The entire Apache manual set was installed on your machine in the "C:\Program Files\Apache Group\Apache\htdocs\manual\" subdirectory. Read it. This guide only covers installation. You (obviously) have to configure your server and learn where to put your documents and the like.

  2. If you need to install PHP support into your server, check out my articles on How to Install and Configure PHP 5 to Run with Apache on Windows (for PHP 5) and How to Install and Configure PHP 4 to run with Apache 1.x on Windows (for PHP 4).

  3. If you wish to support Perl CGI scripts on your server, check out the article on How to Add Perl CGI Support to Your Apache 1.x Web Server on Windows.

Remember, this installation guide is designed for you to install Apache for private offline use. If your site is going "live", I suggest that you not only learn how to configure from the manuals but also brush up on security issues as well.

This article can be found at http://www.thesitewizard.com/archive/apache.shtml

Copyright 2000-2014 by Christopher Heng. All rights reserved.
Get more free tips and articles like this, on web design, promotion, revenue and scripting, from http://www.thesitewizard.com/

thesitewizard™ News Feed (RSS Site Feed)  Subscribe to thesitewizard.com newsfeed

Do you find this article useful? You can learn of new articles and scripts that are published on thesitewizard.com by subscribing to the RSS feed. Simply point your RSS feed reader or a browser that supports RSS feeds at http://www.thesitewizard.com/thesitewizard.xml. You can read more about how to subscribe to RSS site feeds from my RSS FAQ.

Do Not Reprint Without Permission

This article is copyrighted. Please do not reproduce this article in whole or part, in any form, without obtaining my written permission.

Related Articles

New Articles

Popular Articles

How to Link to This Page

It will appear on your page as:

How to Install the Apache Web Server on Windows





Home
Donate
Contact Us
Link to Us
Topics
Site Map

Getting Started
Web Design
Search Engines
Revenue Making
Domains
Web Hosting
Blogging
JavaScripts
PHP
Perl / CGI
HTML
CSS
.htaccess / Apache
Newsletters
General
Seasonal
Reviews
FAQs
Wizards

 

 
Free webmasters and programmers resources, scripts and tutorials
 
HowtoHaven.com: Free How-To Guides
 
Site Design Tips at thesitewizard.com
Find this site useful?
Please link to us.