First, download the latest version (PHP 5.1.6 at the time of this writing) of the PHP binaries (not the installer) from the PHP homepage at http://www.php.net/. These are distributed as a zip file (e.g. php-5.1.6-Win32.zip).
Extract the files to a local directory, preferably one without spaces (e.g. C:\PHP\).
Copy the file php.ini-dist from the PHP distribution directory into your %windir% directory and rename it to php.ini as follows:
C:\>copy C:\PHP\php.ini-dist %windir%\php.ini /v
1 file(s) copied.
C:\>_
Then, bring up the IIS management console, select the web node you wish to configure (e.g. "Default Web Site"), right-click and choose "Properties" in the context menu.
Select the tab named "ISAPI Filters" and then press the "Add" button.
In the edit box for "Filter Name" enter "php" and then either hit the "Browse" button and navigate to the folder where you extracted the PHP distribution and select the file php5isapi.dll and hit "Open" or, directly enter the full path and filename to php5isapi.dll in the edit box e.g. C:\PHP\php5isapi.dll.
Next, select the "Home Directory" tab and press the "Configuration..." button.
In the "Application Mappings" groupbox, press the "Add" button. In the edit box labeled "Extension" enter ".php". In the edit box labeled "Executable" have it point to C:\PHP\php5isapi.dll. When you are done, keep hitting "OK" until you are back to the main IIS management console. Then exit out of the management console.
Once IIS has been configured, it has to be stopped and restarted for the configuration changes to take effect. To do this, open a command prompt and enter the following commands:
C:\>net stop w3svc
The World Wide Web Publishing Service is stopping.
The World Wide Web Publishing Service was stopped successfully.
C:\>net start w3svc
The World Wide Web Publishing Service is starting...
The World Wide Web Publishing Service was started successfully.
C:\>_
To test if PHP was correctly configured, create a file named phpinfo.php inside the home directory (C:\inetpub\wwwroot by default) and put the following text inside it:
<?php
phpinfo();
?>
Then, open a browser window and try navigating to http://localhost/phpinfo.php (do not forget to add the port number if necessary) and if PHP was correctly configured, you should get a page giving a lot of information on the PHP configuration.