Running WordPress on Windows IIS Server: Problems and Solutions

WordPress in no. 1 content management system and well optimized for blogs. But you can use WordPress for any type of websites, be it an e-commerce, general purpose or personal one. Due to ease of maintenance and availability of thousands of plugins and themes; WordPress Development is getting popular day after day.

WordPress runs with PHP in background and hence optimized for Linux server. If you are planning to install WordPress on IIS Server, most likely you are going to get into some problems. WordPress can run on Windows Server with PHP installed, however, it is not as straight-forward as it would be on Linux. But don’t worry; there are solutions available!

Installing WordPress on IIS

 If you are looking to start a new website and are very sure that you will be using WordPress, my recommendation will be to go with a Linux server. However, there are cases, where people first create website in asp.net and later want to shift to WordPress. But by then, they have already made payment to their web hosts for Windows Server. If this is the case with you; you can install and run WordPress on Windows server with some workarounds. There is no doubt it is a little bit difficult but if you know how to sort out the probable problems, this should not be a big deal. Most of the web host companies now support PHP and mySQL with their Windows hosting plans. And most probably, you will get application library from which you can install WordPress with just few clicks.

If you have access to the Web Server (in case you are locally hosting your website), the best way to install WordPress with very less effort is to use Microsoft Web Platform Installer. If you wish to know the step by step process of how to actually do it, here is the guide on WordPress Codex.

But if you are taking the services from a web hosting company which does not provide the option to directly install WordPress, you can go through my step by step tutorial on how to set up a WordPress website.

wordpress-IIS

OK, moving on let’s learn about the most common problems which you are likely going to have with WordPress on Windows Server.

  1. Custom structure permalinks (SEO friendly text links) does not work
  2. Email not being sent
  3. WordPress and Plugin updates fail

WordPress permalinks on IIS not Working

For better SEO, it is always advisable to change the default permalink to custom structure permalink in WordPress. Permalinks are the URLs which appear in the address bar in web browsers. By default, WordPress uses URLs which have a question mark and a number like this:

http://www.webtutorialplus.com/?p=1234

However, this is not SEO friendly. You can actually set it to look something like this.

http://www.webtutorialplus.com/wordpress-beginners-guide/

If you wish to learn how to do that, follow the above link. Now, the problem with IIS server is that once you throw it a URL like above, it will start to find out the default file (default.aspx, index.htm, etc.) in a folder ‘wordpress-beginners-guide’. And since neither the folder nor default file actually exist; it will throw ‘404’ error.

Solution

The solution lies with your web.config file. For those, who are not aware, you define the website configuration of asp.net website with ‘web.config’ file. Look out in your root folder and locate this file. If it is not already there, you can open a new text file (open notepad) and save it as web.config file name. If you are using notepad, make sure you have selected ‘all files’ from ‘save as type dropdown’.

Now, in this web configuration file, we will write the rewrite rule. If you already have the web.config file, insert the following XML code into the system.webserver element.

        <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>

Otherwise, you may like to download this web.config file and straightaway put in the root folder of your website.

Download web.config file

Now change the permalink settings as per your needs and check it once again. Your custom permalinks should work perfectly fine!

WordPress Email not working on IIS Server

This is another known issue of WordPress running on Windows server. WordPress, by default uses PHP mail() function which is not supported by many IIS servers. Whenever you try to send an email through form, you will get the following error message:

The e-mail could not be sent.

Possible reason: your host may have disabled the mail() function…

You get the similar message when you wish to retrieve the password or wish to get notification.

Solution

The solution for this email problem is to change the default email method to SMTP email. I don’t want to confuse you much here. All you wish to do is to install a plugin which changes the default email to SMTP email. I personally use WP-Mail-SMTP plugin. Once you install and activate this plugin, you can set your SMTP email.

For this plugin to work correctly, you need to have an email which supports SMTP email format. Today almost all web hosts will provide you with this, so you know the POP and SMTP host. You need to provide the following information to configure your SMTP email.

  • From Email (The email id which will appear as From. You may leave it blank.)
  • SMTP Host (Something like mail.yourdomainname.com)
  • SMTP Port (in most of the cases it is 25)
  • Username (Email ID)
  • Password (Your Password to access this email)

smtp-email

That’s all. If you have given all the information correctly, your email should work perfectly fine. If your web host allows sending email without SMTP authentication, you can escape writing your email ID and password also. But most of the web hosts today does not allow sending email without proper authentication. Try once to check if it is supported in your case. Try sending a test mail!

WordPress Plugins Update Fails

This one is really annoying and one of the most common problems of running WordPress on IIS server. Whenever you wish to update WordPress or Plugins automatically through your WordPress dashboard, it will fail. You will get the following error message:

Unpacking the update.

Installing the latest version.

Deactivating the plugin.

Removing the old version of the plugin.

Could not create directory. DIRECTORY\wwwroot/wp-content/plugins/akismet/

Plugin upgrade Failed.

At the same time if you try to access the theme folder through FTP and rename or delete it; it will not allow you to do so.

Initially, I thought it is the problem of authentication. I found some people suggesting on various forums to allow read, write and full access permissions of the root folder to ‘IUSR’ and ‘Network Service’. However, it does not solve the problem.

If you restart the server and immediately update the plugin, you will be able to do so without any problem. So, it is clear that this is due to some caching problem in IIS server.

The problem actually is with the WinCache Extension for PHP which function is to boost the speed of the server by caching some of the information. Unfortunately, it also caches the plugin directory and files and that is why the update fails.

Solution

If you are using your own server or have access to the server; you just need to update the WinCache to the latest version. But if you are using the shared hosting, you need to write to the support section of your web host and ask them to update WinCache program explaining your problem. I know, it is not that easy to convince them; so here is the link to the discussion on WordPress support website about the problem and solution. If you send the link to this page to your web host, most probably they will realize the problem and take appropriate action.

And the problem is only with IIS7. If your web host upgrades the server from IIS7 to IIS8; the problem should resolve automatically.

Summary

So, these are the three most common and most annoying problems with WordPress running on Windows IIS server. Now that you are aware about these and know the solutions; you will be better equipped to handle such issues as and when they arrive. Do you face any other problem on Windows hosting for WordPress? Let’s discuss that as well.

Leave a Reply

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