Apache 2.2, PHP 5, and MySQL 5 Install and Setup on Windows XP

The following is a series of notes that I compiled while installing and configuring Apache 2.2, PHP 5, and MySQL 5 on Windows XP:

Apache Installation

  • Download Apache HTTP Server (v2.2) from apache website or from mirror, make sure to get a binary file.
  • Run binary file and install Apache.

MySQL Installation

  • Download MySQL Server from dev.mysql.com, do NOT get “essentials” version.
  • It may ask you to login/signup, etc. Just click the link at the bottom: “No thanks, just take me to the downloads”.
  • Run binary and install MySQL.
  • (Optional) Check configuration box and edit configuration settings to your preference.
  • Make sure that MySQL is added to the BIN PATH.

PHP Installation

  • Download PHP 5, be sure to get the ZIP archive and NOT the installer.
  • Extract the archive to c:\php (or your preferred location).
  • After extraction is complete, copy php5ts.dll to C:\Windows\. Make a copy of php.ini-recommended and rename it to “php.ini”; move this file into your C:\Windows\ folder.

Apache Configuration

  • Open your httpd.conf file (C:\Program Files\Apache Software Foundation\Apache2.2\conf) and find the line that looks like:
DirectoryIndex index.html

Change to this:

DirectoryIndex index.html index.php

Feel free to add other extensions as well (e.g., index.htm, index.php5, etc.) if you wish.

  • Find the area in the httpd.conf file that lists the loaded modules (e.g., “LoadModule foo_module modules/mod_foo.so”) and add the following line wherever you wish (i.e., at the beginning, the end, or alphabetical):
LoadModule php5_module "c:/php/php5apache2_2.dll"

Be sure that the path within the quotation marks points to your PHP directory and to the correct DLL file.

  • Find the area that lists the “AddType” declarations (i.e., “AddType application/x-compress .Z” and add the following line at the bottom of that list:
AddType application/x-httpd-php .php

PHP Configuration

  • Open up php.ini (the file you dropped into the C:\Windows\ directory). Find the line that looks like this: “;extension=php_mysql.dll” uncomment the line by removing the semicolon.
  • Add “C:\php” to your PATH environment variable.