How to Solve Problems in Wordpress on Windows Server
Setting up and running your Wordpress content management system website on a Windows Server isn't always as simple as its Unix counterpart. Lets have a look at some of the common problems and their solutions.
IIS Folder Permissions
The most common and simple way to install Wordpress on a Windows server is to use the Web Platform Installer. This approach works great but it doesn't handle the folder permissions Wordpress will need to run smoothly.
Wordpress will need special permissions in order to update itself, install plugins and themes and access file writing functions.
Open Windows Explorer and locate the root folder that Wordpress is installed in. Right click this folder, select Properties and click the Security tab. From here, choose Edit then Add. The following users must be added and given FULL ACCESS permissions: IUSR & IIS_IUSRS.
Note: the screenshot to the right shows the user: IUSRS. This is not correct. Use IUSR instead.
Once added, Windows will apply these user permissions to all child folders and those created in the future by Wordpress.
Default Document Type & Directory Browsing
IIS does not by default add index.php to the list of accept default documents. IIS will also not allow for directory browsing. This is critical for Wordpress to run correctly. To solve this, locate the web.config file in the root of the hosting space. If it does not exist, create one and add the following commands.
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <directoryBrowse enabled="false"/> <defaultDocument> <files> <clear/> <add value="index.php"/> <add value="Default.htm"/> <add value="Default.asp"/> <add value="index.htm"/> <add value="Default.aspx"/> </files> </defaultDocument> <rewrite> <rules> <rule name="wordpress" patternSyntax="Wildcard"> <match url="*"/> <conditions> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/> </conditions> <action type="Rewrite" url="index.php"/> </rule> </rules> </rewrite> </system.webServer> </configuration>
Slow Page Loading
I find that pages load very slowly when using the default Wordpress configuration. Luckily, this is an easy fix. Open the wp-config.php file in the root of the Wordpress installation folder. Locate the following line of code:
define('DB_HOST', 'localhost');
I'm not entirely certain why but this causes a very noticeable delay in page loading. Change this code to the following:
define('DB_HOST', '127.0.0.1');
Ah , that's better, now your pages are loading nice and fast.
Maximum File Upload Size
"This file exceeds the maximum upload size for this site". If you have not yet encountered this error, chances are you will at some point. If you used the Web Platform Installer to install PHP for Windows, the maximum file upload size will be set to 2 megabytes. For most users, this is insufficient. This is also an easy fix.
Locate the folder PHP was installed in. It is typically found at C:\Program Files (x86)\PHP\v5.x\. Open php.ini and locate the following variable:
upload_max_filesize = 2M
Change it to the following:
upload_max_filesize = 10M (or whatever size you need it to be)
Upload away!