This tutorial describes how to setup PHP on Windows (tested with PHP 5.1.2 on Windows XP Professional).
Install
Download the precompiled zipped Windows binaries of PHP from http://www.php.net/downloads.php.
Create the C:\php directory and extract the downloaded .zip file into it.
Copy C:\php\php.ini-dist to C:\php\php.ini.
Configure Apache for PHP
To test PHP together with Apache, first setup Apache on Windows.
When Apache is working properly, add the following lines to Apache's httpd.conf:
# For PHP 5 do something like this:
LoadModule php5_module "c:/php/php5apache2.dll"
AddType application/x-httpd-php .php
# configure the path to php.ini
PHPIniDir "C:/php"
Restart Apache, and be sure there are no error message in the error log file.
Then create a test .php script, let's say phpinfo.php, in the Apache Document Root (C:\Program Files\Apache Group\Apache2\htdocs by default on Windows):
Configure PHP for MySQL (optional)
If you plan to use PHP together with MySQL, then first setup MySQL on Windows.
In PHP version 5, the MySQL extension is no longer enabled by default, so you have to do this manually in php.ini (I couldn't get it to work with the default extension_dir = "./"):
; Directory in which the loadable extensions (modules) reside.
;;;extension_dir = "./"
extension_dir = "C:\php\ext"
To enable an extension, look for the Windows Extensions section in php.ini and just uncomment the extension(s) you want to enable (all extensions are disabled by default).
MySQL requires the php_mysql.dll to be enabled, and if MySQL is configured for UTF-8 instead of the default MySQL charset, Latin1, the MultiByte String extension, php_mbstring.dll has to be enabled as well.
MySQL support:
extension=php_mysql.dll
If you use the UTF-8 instead of the Latin1 charset: