Install & Configure Apache, PHP, JSP, Ruby on Rails, MySQL, PHPMyAdmin & WordPress on Windows XP/2000
Install PHP
Prerequisites
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: php-5.1.6-Win32.zip
Download Location: http://www.php.net/downloads.php
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: php5.2-win32-latest.zip
Download Location: http://snaps.php.net/win32/php5.2-win32-latest.zip
Install
- Extract php-5.1.6-Win32.zip to C:\php.

- Create a copy of c:\php\php-ini-recommended.ini and rename it to c:\php\php.ini.
- 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 = \ - Add C:\php to your PATH System Environment Variable
- Right-click on My Computer and choose Properties.
- Select the Advanced tab.
- Click Environment Variables.
- Under System variables, select “Path” and choose Edit.

- Move the cursor to the end of the string and add ;C:\php.
A basic path will look something like the following:
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\php
- Click OK.
- Click OK.
- 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 php5.2-win32-latest.zip.
- Open the Zip file and extract php5apache2_2.dll to C:\php.
- 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
Test
- Restart Apache.
Hint: Click on the Apache system tray icon, and choose Apache 2 > Restart.
- Open http://localhost/ in a web browser. If you see something like the following, Apache restarted successfully.

- 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();?>
- Open http://localhost/phpinfo.php in a web browser. If you see something like the following, you have successfully installed PHP!
