Deploy WordPress to Windows 2008R2 – Part II

Part 2 – Install MySQL and PHP

Download the latest and greatest MySQL Community Server software from the MySQL Community Server Downloads  page (at the time of this writting it was release 5.5.27. I downloaded the 64-bit edition, i.e. mysql-5.5.27-winx64.msi). Install MySQL following the easy steps explained in this interesting blog entry. You can tweak a bit, but you will be perfectly good if you just use the same settings.

With MySQL installed, it is time to install PHP. Although our server is 64-bit, I am going to install a 32-bit edition of PHP, not a 64-bit edition. It is true, there are unofficial 64-bit releases of PHP, they are good but don’t have the latest PECLs (PHP extensions) and you will need them (particularly the WinCache PECL). Since PHP is going to run out-of-process, either 32-bit or 64-bit does not matter. So, point your web browser to the official PHP web site and select the latest PHP stable release (at the time of this writing it was release 5.4.6). Select the “Non-Thread Safe” variation (most suitable for IIS) and download it (the file was Unzip and extract the content to C:\inetpub\php (can be another folder). The situation now looks like the following image.

PHP Folder

Before doing anything else and become frustrated because it does not work and the cryptic error messages do not help track the origin of the problem you need to install the Microsoft Visual C++ 2008 Redistributable Package (because PHP was compiled with it). Download it from Microsoft and install.

Now launch Internet Information Server Manager to add a Module Mapping of PHP to FastCGI. Follow the procedure from this blog (nice blog, already mentioned above).

Add Module Mapping

Time to confirm if PHP is working. With Notepad, make a text file called phpinfo.php with just one line of text:

<?php phpinfo(); ?>

Place phpinfo.php in c:\inetpub\wwwroot, launch your web browser and point it to:


If all went well, you will see something like this image:

PHP Info

Continue reading the blog mentioned above and launch the Registry Editor (Regedit.exe) to add the key PHP to HKEY_LOCAL_MACHINE\SOFTWARE. Create a string value called IniFilePath for that key and set it to: c:\inetpub\php.

In your PHP folder, search for php.ini-production and rename it to php.ini.

Edit php.ini with Notepad, or another fine plain text editor, search for extension_dir = “ext”‘ and uncomment it by removing the semicolon.

Uncomment the following extensions:
extension=php_exif.dll ; Must be after mbstring as it depends on it
Note: You may not need all these extensions (and you may need others too), but let it stay like this for now.

Still in php.ini uncomment then set where required:
fastcgi.impersonate = 1
cgi.force_redirect = 0

Make a folder named phpTempDir, under the PHP install folder, give read, write, modify permissions to the IIS_IUSRS account then set php.ini like this:
upload_tmp_dir = “C:\inetpub\php\phpTempDir”

 (continues in part III…)

Leave a Reply

Your email address will not be published. Required fields are marked *