I recently decided to experiment with hosting my own blog and after looking at the various packages available decided that I wanted to use WordPress. However, when it came to installing WordPress, I found that there was a lack of really good documentation available if you wanted to use IIS 6.0 as your web server. I also found quite a bit of contradictory information regarding the installation of PHP and MySQL on Windows 2003 - so I decided to write my own. This is the first of a series of articles which will provide a complete walkthrough enabling you to install PHP, MySQL and WordPress on an IIS 6.0 web server.
At the time of writing, the latest stable version of PHP is 5.1.4. Start by downloading the zip package and the Collection of PECL modules from here : http://www.php.net/downloads.php
#Note: You can use the Windows Installer package but it only installs and configures the CGI version of PHP which is not the best solution for an IIS web server; you should try to use the ISAPI version - if you really want to know more about why this ISAPI is preferable to CGI then I suggest you watch this IIS webcast :
TechNet Webcast: Comparing CGI and ISAPI in IIS 6.0 - Level 300
Install and Configure PHP
Start by creating a directory into which you will extract the downloaded PHP files (php-5.1.4-Win32.zip). In this example I’m going to use C:\PHP as my installation directory. Then extract the files from php-5.1.4-Win32.zip into C:\PHP
If you need to use the additional PECL modules then extract the files from ‘pecl-5.1.4-Win32.zip’ into the C:\PHP\ext directory.
Next locate the file ‘php.ini-recommended’ in C:\PHP and rename it to ‘php.ini’ (without the quotes of course)
Open the ‘php.ini’ file and find the line which reads extension_dir = “./” and change it to extension_dir = “C:\PHP\ext”. This tells PHP where the various extensions are located and as you can see the default path in the ‘php.ini-recommended’ file which ships with PHP points to the wrong location, so you need to change it.
You also need to add the location of your PHP directory to the server’s PATH environment variable so that Windows knows where to look for any PHP related executables (such as the PHP extension DLL‘s). To do this Right-click on My Computer, click Properties and on the Advanced tab click Environment Variables. In the Environment Variables dialog box, under System variables highlight the Path variable and click Edit.
Add ‘;C:\PHP’ (be sure to include the semi-colon separator) as shown here and click OK. You need to re-boot the server for this change to take effect.
If you browse through the ‘php.ini’ file you will see an entry describing the ‘cgi.force_redirect’ property. You will also see a statement telling you that if you are using IIS you ‘MUST’ turn this off. However, this only applies if you are using the CGI version of PHP (i.e. php-cgi.exe) Since we are using the ISAPI version of PHP we can safely ignore this - more details here : http://www.php.net/release_4_1_2_win32.php
You may have also seen various IIS and PHP HowTo guides which suggest that you need to copy your ‘php.ini’ and some other PHP related files to the C:\Windows\System32 directory - this is not actually necessary, as I shall demonstrate later in this walkthrough.