Quick Install Guide for Apache & PHP - for Windows

This is a quick installation guide for Apache and PHP, running on Microsoft Windows.
Personally, I always keep my web applications out of the default c:\Program Files\ directory, since the space in the directory name is a hassle, but you are free to install these applications where you like. This guide assumes you will be installing the software in c:\bin.

Apache 2.x

  1. Download Apache for Windows from a server close to your location: httpd.apache.org/download.cgi.
  2. When download is complete, execute the Windowns Installer Package.
  3. Basically follow the instructions. Note that a directory will be created in the location you specify. Create and choose, for example: c:\bin\. Apache will then be installed in c:\bin\Apache2.
  4. Browse to http://localhost/. A page saying "It Works!" should appear.

PHP 5.x

  1. Download the ZIP-version of PHP for Windows: windows.php.net/download/.
  2. Unzip to c:\bin\. PHP will then be installed in c:\bin\php-5.3.0 (where version depends on your download). This document assumes PHP to be installed in c:\bin\php (so either rename install dir, or substite correct dir below).
  3. Make a copy of php.ini-dist and rename it to php.ini.
  4. Open php.ini in your favorite editor and set extension_dir to c:\bin\php\ext.
  5. Edit Apache's configuration, c:\bin\Apache2\conf\httpd.conf, find the section after the LoadModule's and add these lines:
    LoadModule php5_module "c:/bin/php/php5apache2.dll"
    AddType application/x-httpd-php .php
    PHPIniDir "c:/bin/php"
  6. Find the line that reads: DirectoryIndex and add index.php
  7. Restart Apache (either use the Apache monitor in the Tray, or the option in the Start menu: Start, All Programs, Apache HTTP Server, Control Apache Server, Restart).
  8. Create a file c:\bin\Apache2\htdocs\phpinfo.php (in Apache's default document root) and add these lines:
  9. Browse to http://localhost/phpinfo.php and watch the magic unfold...

Good luck and happy programming!