Install & Configure Apache, PHP, JSP, Ruby on Rails, MySQL, PHPMyAdmin & WordPress on Windows XP/2000

Install PHP


On the PHP download page, click on the zip package under the Windows Binaries section. Choose a mirror to begin downloading.

Version: 5.1.6
File Name:
Download Location:

To get around a known bug with PHP 5.1 and Apache 2.2, you must also download a newer version of PHP.

Version: 5.2.0RC5-dev
File Name:
Download Location:


  1. Extract to C:\php.
    Extract to C:\php
  2. Create a copy of c:\php\php-ini-recommended.ini and rename it to c:\php\php.ini.
  3. Open php.ini with a text editor and change the following lines, and then save it.

    Uncomment the include_path for Windows. Line 515.
    include_path = ".;C:\php\includes"

    Change the doc_root to match your httpd.conf DocumentRoot directory. Line 522.
    doc_root = "C:\Program Files\Apache Software Foundation\Apache2.2\htdocs"

    Change extension_dir. Line 529.
    extension_dir = "C:\php\ext"

    Change session.save_path and session.cookie_path. Line 949 & 968, respectively.
    session.save_path = "C:\Temp"
    session.cookie_path = \
  4. Add C:\php to your PATH System Environment Variable
    1. Right-click on My Computer and choose Properties.
    2. Select the Advanced tab.
    3. Click Environment Variables.
    4. Under System variables, select “Path” and choose Edit.
      Environmental Variables
    5. Move the cursor to the end of the string and add ;C:\php. A basic path will look something like the following:
    6. Click OK.
    7. Click OK.
  5. There is a known bug with PHP 5.1.6 and Apache 2.2.x. To get around this, we'll use a DLL from the CVS snapshot of PHP 5.2. Download
  6. Open the Zip file and extract php5apache2_2.dll to C:\php.
  7. Open your httpd.conf file located at C:\Program Files\Apache Software\Apache2.2\conf\. Append the following lines.
    LoadModule php5_module "c:/php/php5apache2_2.dll"

    AddType application/x-httpd-php .php

    PHPIniDir "C:/php"

    Add index.php to the DirectoryIndex, and then save. Line 212.
    DirectoryIndex index.php index.html


  1. Restart Apache.
    Hint: Click on the Apache system tray icon, and choose Apache 2 > Restart.
  2. Open http://localhost/ in a web browser. If you see something like the following, Apache restarted successfully.
    Apache Test
  3. Create a new text file called phpinfo.php and paste the following into it. Save it in your DocumentRoot directory (default is C:\Program Files\Apache Software Foundation\Apache2.2\htdocs).
    <?php phpinfo();?>
  4. Open http://localhost/phpinfo.php in a web browser. If you see something like the following, you have successfully installed PHP!
    phpinfo page