Computer Bookshelf

Revised installation instructions for PHP, Apache & MySQL

Installing Apache on Windows

Installing Apache is very easy, because it's distributed as a normal Windows installation program. Once it's installed, you need to make a few adjustments to the Apache configuration file, httpd.conf, but it's a text file like php.ini, so it should hold no unpleasant surprises.

For a long time, the PHP development team recommended using Apache 1.3 in preference to the newer Apache 2.0. This is no longer the case. The only exception is if you're on an old version of Windows, such as Windows 98, in which case you should still use Apache 1.3. The setup procedure for both is virtually identical.

These instructions assume that you do not have Microsoft IIS (Internet Information Services) or PWS (Personal Web Server) running on your system. Separate instructions for running PHP on a computer that has IIS or PWS installed will be added soon. In the meantime, you should either disable IIS/PWS in the Windows Services panel (accessed through Control Panel > Administrative Tools > Services), or select the manual option in step 4 below.

  1. Go to http://httpd.apache.org/download.cgi, and select the file marked Win32 Binary for the latest version of Apache 2. (Windows 98 users should select the Win32 Binary for Apache 1.3, lower down on the same page.) Download the file to a temporary folder on your hard disk.
  2. Close all other programs, and temporarily disable any anti-virus scanning. Double-click the icon of the file you have downloaded, and follow the instructions onscreen. Accept the default values in each dialog box. The only part of the installation process that requires your input is a dialog box asking you to enter details of your server, as shown in the following screenshot.

    Apache server information dialog box

  3. Fill in the details as shown. Unless your computer is running on a local domain, Network Domain and Server Name should both be set to localhost. The Administrator's email address doesn't need to be a genuine one, as it has no bearing on the way the program runs and is normally of relevance only on a live production server.
  4. The most convenient way to run Apache is as a Windows service. This will ensure that Apache starts up automatically, and runs unobtrusively in the background consuming very few resources. This is the default option, which you should accept, unless you are also running IIS/PWS, in which case you should accept the option to install Apache to start manually on Port 8080. This will prevent a conflict between both web servers trying to listen on the same port.

    The option to run as a service is likely to be greyed out on Windows 98. Your only option is to select a manual start. (The wording on Apache 1.3 differs slightly from the screenshot above.)
  5. After filling in the Server Information dialog box, continue through the rest of the installation wizard. When the installation process starts, don't be alarmed if you see a Windows Command Prompt open and close several times. This is quite normal. If you are running a software firewall, such as Norton Internet Security or Zone Alarm, you will probably receive warning messages. Adjust the settings in any dialog boxes to permit Apache to communicate.
  6. Depending on the speed of your computer, the installation process should take only a minute or two. Apache monitor iconIf you selected the default option to start Apache as a service, you should see a small icon, like the one shown alongside, in the taskbar tray at the bottom right corner of your monitor. If it has a right-facing green arrow in a white circle, it means Apache is running. If it displays a red dot in the circle, Apache is stopped. Click the icon to see the options it offers: start, stop, and restart. This is the most convenient way to control Apache 2.

    Apache 1.3 does not install this icon. Windows 98 users should start Apache manually from the Start menu ( Programs > Apache HTTP Server > Start Apache in Console). On Windows 98, Apache needs to run in a Command Prompt window that can be minimized, but which must stay open the whole time it is in use.
  7. Once you have installed Apache, you can reactivate anti-virus scanning. Then, make sure Apache is running, open a browser, and type http://localhost/ in the address bar. You should see a test page in your browser, confirming that Apache is working. (If you selected the option to start Apache 2 manually, change the address to http://localhost:8080/.)
  8. Now it's time to configure Apache to work with PHP.