Deploy WordPress to Windows 2008R2 – Part III
Part 3 – Fine tun then install a fresh WordPress for testing
We need two IIS Extensions for proper working of IIS 7.5 with WordPress, they are URL Rewrite and Wincache extension for PHP.
- URL Rewrite
This extension is important if you want to have Pretty Permalinks (and who does not?) in WordPress. If you don’t know what I am writing about, read here about Permalinks in WordPress (or directly from WordPress).
Point your web browser to http://www.iis.net/downloads/microsoft/url-rewrite, and by the end of that web page, select one of the x64 variants, according to your language. For English, I downloaded rewrite_2.0_rtw_x64.msi.
Install URL Rewrite 2.0, then follow the instructions on the above referenced links to set the web.config manually and you will be done. Note: WordPress 2.8 and later will update web.config for you if you grant write permission to web.config file (but grant temporarily only!).
To download Wincache, point your web browser to http://www.iis.net/downloads/microsoft/wincache-extension. Don’t be scared by the apparent abandon of the page, it comes as no surprise that Microsoft does not care much about PHP since this competes directly with their own .Net product. Anyway, around the bottom of the mentioned page you will find a link to WinCache 1.3 for PHP 5.4 – x86. Wow, this URL takes us to Sourceforge, so Wincache is not really a Microsoft product.
To install Wincache, run it to unzip the content to a folder then copy php_wincache.dllto the PHP extensions folder (C:\inetpub\php\ext). Edit php.ini and change or add the following:
- In the dynamic extension section add:
- Search for the line session.save_handler = files and replace it with the line session.save_handler = wincache
- Make a folder under the PHP tree, call it phpsessions, give Users and IIS_IUSRS permissions to read, write, modify and delete on that folder. Add the following line to php.ini:
session.save_path = “C:\inetpub\php\phpsessions”
- Restart IIS then launch phpinfo.php again (see Part II) to confirm that Wincache is inserted in the system
- In the dynamic extension section add:
We are done with the tuning, time to go to the WordPress website and download the latest WordPress distribution, which was 3.4.2.
Important: Here, installing WordPress is only for illustration purposes because, as you will see in the final Part IV of this tutorial, we don’t need WordPress previously installed when publishing to a web server a website already developed in our home or office computer.
So, place the WordPress distribution in a suitable place within the inetpub folder, such as inside wwwroot, then unzip it. The whole WordPress will be unzipped to a subfolder of wwwroot, very appropriately called wordpress. If what you wanted was build a new website exclusively based on WordPress you could have placed the WordPress distribution directly inside the inetpub folder (or anywhere), unzip, rename the obtained wordpress folder then set that folder as a website from within IIS.
Before we can run WordPress, we need to do a few things.
- In IIS Manager, select the Default Web Site. Double-click Default Document, select Add from the right pane and add index.php to the default documents list. Move index.php to the top of the list.
- To set up a mySQL database, download phpMyAdmin. The release I got was 188.8.131.52. Extract the distribution to C:\inetpub\wwwroot\phpmyadmin. Navigate to http://localhost/phpmyadmin, type root for user name and the password should be the same used when you set up the mySQL software (Part II of this tutorial). Then Create a New Database, giving it an appropriate name (like “wordpress”). Collation should be set to utf8_general_ci.
- In the wordpress folder, rename wp-config-sample.php to wp-config.php. Edit wp-config.php with Notepad (or similar). If necessary, change the line define(‘DB_NAME’, ‘wordpress’) replacing wordpress with the name of the database chosen in step 2 above. Change the lines define(‘DB_USER’, ‘wpuser’) and define(‘DB_PASSWORD’, ‘yourpasswordhere’), using the user name and password for the mySQL database. All this procedure has been utterly simplified, but we are now ready to launch the WordPress test website.
- Point your browser to http://localhost/wordpress and you should see the WordPress installation welcome page.