Development Guides Windows

The Complete Guide to Running WordPress on Windows/IIS

So you’ve discovered to your absolute horror that the WordPress site your company has inherited is running on Windows… on IIS?

Before you stand up, throw your computer chair out the Window, maliciously eat your co-workers salad and enjoy it, or drop all the production databases, relax. We’ve got you covered.

🤷 What’s the problem?

Good point. IIS (Information Internet Services) is the home-grown proprietary (for now) web server provided by Microsoft for Windows customers. IIS is fantastic at what it does, and can serve as an efficient web host as well as an absolutely golden reverse proxy server.

So what’s the problem?

🙅🏾 Support

Zilch. Nada. No dice. WordPress is absolutely not designed to be run on IIS and probably never will be. This doesn’t mean your server is going to burst into flames when you run the site, but means that when support is needed you can be damn well sure your first bit of advice will be “don’t use Windows”.

So don’t use IIS? Simple?

Except that currently NGINX is crippled on Windows (source), and Apache, which is thankfully available on Windows via unofficial channels… But you still have very little support since it operates differently being on Windows.

However, WordPress requirements state:

We recommend Apache or Nginx as the most robust and featureful server for running WordPress, but any server that supports PHP and MySQL will do.

– so don’t lose hope just yet.

📂 The web.config File

If you’re coming from an Apache background, you might be used to a .htaccess file. Just like how .htaccess is not compatible with NGINX, it is also not compatible with IIS.

For each folder of importance to IIS, a web.config file will appear in the directory. This tells IIS what fancy features and involvement the folder has with web capabilities. It will store everything configuration-wise, so do be careful not to delete or corrupt this file.

web.config is an XML file, and can be easily edited in an editor of your choice. Once you get very comfortable with IIS, you’ll find yourself editing the file manually more often than using the GUI console. This will also to reduce the management overhead of changing IIS settings.

An example of useful properties stored in here are:

  • Priority list of the default index to load.
  • URL rewrite/redirect rules.
  • Request filtering, blocking and setting adjustments.
  • Directory over-riding of parential settings (e.g. PHP Version).

⚙️ Setting up WordPress

First you will need a database. It is recommended you have the database on a different server for performance and security reasons, but you can also have MySQL running on the same server as IIS.

MySQL runs well on Windows, and is very well supported. You shouldn’t expect much push-back in the way of configuring MySQL. However, if you wish to use Microsoft SQL Server, you may wish to check out Project Nami.

Once completed, setup a database and access user like you would a Linux-based setup installation.

Also, while it’s best to always be running the latest version of Windows Server, please consider using a version no later than IIS 10 (Windows Server 2016). This is because older versions of IIS do not have support for HTTP/2. Technically speaking the minimum requirement is IIS 7 (Windows Server 2008).

🐘 PHP on Windows/IIS


You will need to configure IIS to use CGI processing for IIS (which isn’t enabled on default IIS installations).

You also need the URL Rewriting module for IIS, unless you are planning on using those super ugly index.php URLs.

PHP is fully supported on Windows. To download PHP, visit their website at You will also need the C++ Redist 2019 which is found on the sidebar on their website downloads.

This guide will use FastCGI, which will require a Non-thread safe version (NTS) of PHP. Typically the first download listed in each PHP version on their site will be the ideal version for IIS.

Download the correct zip file and extract it to a place of your choice on your server (Program Files is acceptable). My choice is normally C:\PHP\X.X.X (version number).

If you’re planning on running any PHP tools such as WP-CLI, it would also be a good idea to add the above path to your system Path environmental variable.

To do so, open Run (Win key + R), and run rundll32 sysdm.cpl,EditEnvironmentVariables. Append the path to Path found under System variables.

Installing WP-CLI (optional)

Now is a good time to install WordPress CLI if you’re planning on using it. They provide a fantastic guide to setting up WP-CLI on Windows.

Web Platform Installer – Easy

Windows Server has an optional comonent called the Web Platform Installer. This neat application provides a collection of the most well-known and loved software packages, and provides super-easy methods of installing them. Guess what, WordPress included! You just need to install IIS with CGI first.

Create a Site as regular, and double-click on it. You should have an option in Management called Web Platform Installer (at time of writing, it’s a circular, orange download icon). Open this up, and a new panel will load up. Search for WordPress, click Add, then Install.

❓ No Web Platform Installer? It’s not installed by default. Click your server name in the Connections left-hand panel. In the now-visible right-hand panel, click on Get New Web Platform Components. Follow the Microsoft instructions and you’ll have the aforementioned button.

Now for configurations, you should generally always separate up your servers (e.g. web and database are separate). But sometimes, you just want a get going quickly on a development site. This installer has a neat trick. If you do not have a database server, and the current machine doesn’t have MySQL installed, it will create a MySQL server instance for you!

If done correctly, you should be at this screen. It will by default try to create localhost/wordpress. Make sure you’ve got the right Web Site selected, and – if desired – the right subfolder configuration. If something is wrong, it will need to be changed manually afterwards.

Hit Continue, and go grab a coffee. When you return, WordPress is installed! Easy as that, you’ve got your first WordPress installation.

For the technical information:

  • Microsoft WebMatrix is installed.
  • ❗ PHP 7.1 is installed via IIS Express.
    • A newer version of PHP is recommended.
  • A global FastCGIModule for PHP is created.
    • This means all sites on your IIS server can run PHP code via this module. Change priority listings if you wish to run different versions.
    • You can use the PHP Manager or manual process to over-ride this.
  • MySQL 5.1 is installed, if no external database was provided.

PHP Manager IIS Plugin – Intermediate

There is a plugin for IIS called PHP Manager, which is able to do most of the heavy-lifting for you in configuring PHP. This will enable you to register new PHP versions, adjust plugins, edit configurations and even split containers to different IIS versions as simply as possible via GUI.

Simply download their extension and install it on your server. When you next run IIS you will find a new PHP module on the snap-in.

You can register a parent PHP version and it will affect all children sites. If you register an alternative version on a child site, it will over-ride the parent and so on, in a hierarchical manner. Multi-version PHP, hooray a benefit!

PHP Manually – Advanced

If you opt not to go for IIS manager (not a fan of community IIS modules), then you can still go ahead configuring PHP manually to the IIS container.

First you need to tell the FastCGI system about your PHP installation.

  • Open IIS.
  • Click on the root server (just below Start Page on the left pane).
  • Open FastCGI Settings.
  • On the right hand side, click on Add Application…
  • In Full Path, navigate to php-cgi.exe in your extracted php setup.
  • In Monitor changes to file, set this to your php.ini file.
  • Click on … on the end of the row named Environmental Variables.
  • Click Add.
  • Add PHPRC variable with the value of the PHP installation path, where your PHP-CGI file was above.
  • Create another variable named PHP_FCGI_MAX_REQUESTS, and match it to the value in Instance MaxRequests (recommendation for both is 10000).
  • Click OK.

Cool! IIS now knows that your PHP folder is a CGI process, it now knows how to handle requests to PHP with this processor. Now let’s set up the individual website to use PHP CGI.

  • Find your container in IIS (e.g. Default Web Site) and click it.
  • Open Handler Mappings.
  • On the right-hand side, choose ‘Add Module Mapping‘.
  • Add the following entry:
    • *.php for Request Path.
    • FastCgiModule for Module.
    • Path to your PHP CGI for Executable.
    • Whatever you want for Name.
  • Head back, and go into Default document.
  • Add index.php to the list (your choice).
  • Test in your browser if PHP loads up.
    • Try index.php file with <?php phpinfo();

If you do the above for the topmost entry (normally your machine name), it will copy to all new containers, so you don’t need to do this process for each site.

Recommended php.ini Configuration

The perfect php.ini configuration is very much a game of trial and error. Believe me, it’s difficult to find the best config balance when it comes to PHP, WordPress and Windows. Here are some essentials:

  • cgi.force.redirect = 0 (essential!).
  • fastcgi.impersonate = 1
  • extension_dir = <Absolute path to install>/ext

These are set when using PHP Manager. This configures PHP to understand that it is operating via CGI mode. The second configuration also helps to link the PHP operations into how IIS works, enabling better interop between PHP and IIS.

The third is recommended especially if your PHP installation is not located on the C drive. Absolute stops PHP trying to interpret where the extension dir is, which is can get very wrong if not located on the C drive.

Setting up WordPress

Now for an easy part – the WordPress installation! Thankfully this is as easy to do, if not easier than the Linux server counterpart.

Create your desired site in IIS. If you’re binding this a domain or subdomain, create a new site. Otherwise, you can create a subfolder (or virtual subfolder) in IIS to setup a subfolder WordPress installation.

In the folder you bound to the container, extract the WordPress installation zip (or use WP-CLI if installed earlier). If done correctly when you visit the URL in the browser you will see the good ol’ 5 minute installation screen.

Run through the installation as per a normal site, and congratulations – you have a WordPress site running on IIS!

⭐ Special Thanks

In the hopes of keeping the information up to date and relevant, the following commenters below have helped keep me in check:

  • Patrick Bates for pointing out Web Platform Installer.
  • John Wilkin for pointing out I did not cover web.config.

ℹ️ FAQ

I received an error: 500 The FastCGI Processed exited unexpectedly.

Each version of PHP for Windows depends on a Visual C++ Redist package, which is mentioned in the download title. Normally recieving this error means your system does not have the one it needs, causing the CGI process to error.

In each download segment on the downloads website, check for VCXX (X being numerical). The left-hand sidebar will tell you which redistributable package you need and how to obtain it. Once installed, this error will stop.

If – for whatever reason – you are installing the Legacy 5.6 releases, download the 32-bit redistributable, regardless of your server architecture type.

I recieved an error: 500.21 Handler “xyz” has a bad module “FastCGIModule” in its module list.

When installing Internet Information Services (IIS), PHP runs through CGI. This lets IIS pass the processing of non-Microsoft language code to it’s relevant processor. For us, it enables IIS to chuck .php code at PHP.

This error simply means that the CGI module it uses (FastCGI) was not installed. This is easily fixed!

Open up Server Manager. At the top right, open up Manage, then Add Roles and Features.

Next next next it through until you get to Roles. In Web Server (IIS) > Web Server > Application Development > Check CGI. Click Install (or next until you can), and your IIS server should now support CGI, including FastCGI

Pretty Permalinks, and .htaccess

WordPress is smart enough to know it’s on IIS, so when you go to adjust permalinks instead of creating .htaccess, they will create a web.config file, which is the IIS equivalent. If you need additional rules the IIS rewrite module can attempt to parse your htaccess file in the IIS module.

If you create a .htaccess file, it will be ignored – IIS rewrite can attempt to convert these files, but not use them.

How do I disable xmlrpc via IIS?

In my years of WordPress, this only recently popped up for me – people abusing the xmlrpc.php interface. There’s a range of options to deal with this in WordPress, but they all involve WordPress loading. I personally think it’s better to use IIS to block the interface instead.

Via web.config

Locate the <system.webServer> block, and add this (normally at the bottom):

      <add sequence="xmlrpc.php" />

Any request will now serve a request denied error, instead of passing through to the interface. This stops WordPress processing said requests, therefore stop wasting processing power on these bogus requests.

How do I set permissions?

The container will default to using the account IUSR, which won’t have access rights by default. For starting out, you could simply give IUSR full permissions to the folder, and your website will work. Updates will occur, cache will write, all gold.

This sometimes does not work, in which an alternative you can do is change Anonymous authentication in Authentication on the container to Application Pool identity, and give IUSRS group full access.

Both of these are not recommended for production use, as in the event of a compromise the hacker will have full write access. You can check out the guide on permissions from WordPress, as the permission fundamentals are similar.

How do I enable HTTP/2?

HTTP/2 is only supported in IIS 10 or above, which requires Windows Server 2016 or higher.

How do I increase the runtime limits?

In PHP Manager, on the container you wish to adjust, click on Set runtime limits. This will show the php.ini config options to quickly change these limits. For everyone else, you can find the limits within php.ini like always.

If you wish to increase the maximum execution time, please note that both PHP and IIS track timeouts differently. As well as increasing this via either PHP Manager or php.ini, you will need to tell IIS too.

Pop over to the root (underneath Start Page on the left panel in IIS). Open FastCGI Settings, and find the CGI you wish to modify. Click edit, and you should see two settings called Activity Timeout and Request Timeout. Set these both to whatever limit you want, and make sure all three (inc. PHP’s max_execution_time) match. Your timeout should now be sufficiently increased!

Should I choose Windows over Linux for WordPress?

No. Absolutely not.

Can I hook WordPress into Microsoft SQL Server?

Project Nami is a fork of WordPress that is designed to work with Microsoft SQL Server in place of MySQL. This team has replaced all MySQL functionality and added some beneficial functionality from SQL Server. This is well worth checking out!

Can I run multiple versions of PHP?

Yes! Arguably this is one of the only benefits of running PHP on IIS, you can run multiple PHP versions.

When you are looking at the Module Mappings segment (either site or server-wide), there should be an option on the right-hand side column that says View Ordered List…. The topmost version of PHP will be the chosen version, so use this to your advantage to change which version your site operates with.

Article was updated on the 21st June 2020 to elaborate on the web.config file, and cover WMI deployment.


Linux it up like 2008 with Wubi, which still exists

Wubi was Marmite back in the day. With Linux being pitched as an alternative to Windows, people weren’t particularly impressed with using Microsoft technology to boot up a virtual Linux installation. Alongside the genuine concern that a power outage would obliterate your Linux setup, Wubi faced a lot of criticism.

Wubi installed a full desktop Ubuntu installation inside a virtual hard drive on your Windows machine. Yep, you could literally install Ubuntu like a regular application, and boot into a full Ubuntu OS instead of Windows. Dual booting went from being a nightmarish partition juggle of your main drive, to a literal one-click install.

Wubi fell out of favour around 2012 as the Ubuntu installer made hard drive partitioning ridiculously easy, and virtualisation stopped tanking your PC. But the advent of UEFI pushed Ubuntu back from super easy installation, into needing some technical know-how to setup. A correct setup was also devoid of the Wubi problems such as power outage corruption and NTFS performance impacts.

With a reduced interest in Wubi, development stopped… Until now… Ish.

Welcome, Wubiuefi!

🧐 What does WubiUEFI do?

WubiUEFI installs a full Ubuntu flavour into a virtual hard drive, stored on your Windows machine. It then instructs Windows to add an entry to your bootloader to boot up the installation on this virtual drive.

Literally that simple.

💩 What’s the Catch?

The hard drive you boot from is a virtual disk, which is being accessed via a Windows NTFS layer. This adds a small speed overhead that you will notice when WubiUEFI is installed to a hard drive, rather than an SSD. This also makes the system a lot more suceptible to data corruption in the event of a hard power off, like a power cut.

It can also be a pain to configure on a UEFI system with secure boot enabled, but not impossible to do.

🖥️ Will WubiUEFI break Windows?

WubiUEFI depends on Windows so you can rest assured it absolutely will not break your Windows installation! Ubuntu is installed into a file, not a partition. In other words, this won’t fiddle around with how your system fundamentally works.

WubiUEFI will add an extra item to the Windows bootloader, so when you boot up your PC it will ask if you want to reboot into your Linux install instead of continuing into Windows.

❌ Can I remove it easily?

Probably one of the best things about a WubiUEFI installation, yes! Removing WubiUEFI installations is done by simply popping open Programs in settings, and uninstalling Ubuntu! Job done.

If you want to do the reverse however, you may be out of luck. While it’s possible, it’s an incredibly long-winded and risky approach. It has be done before on older versions, but your mileage may vary. A full manual installation would be recommended if you wish to move away from Windows.

After some jiggery-pokery, my finished Wubi-installed Kubuntu.

💡 What’s WubiUEFI good for?

WubiUEFI is absolutely fantastic for giving Ubuntu an extended trial without the lack of storage from running a LiveUSB. Even better for giving various different flavours a try, as you can dispose of the installation afterwards should you not like it.

Note that on a decent/fast machine, it may be more preferable to install Ubuntu in a virtual machine, as you will not have to leave Windows for this.

If you’re a person who tends to store all their important files aside from the main OS drive, and don’t mind the potential data loss from a power loss, this is a quick and easy way for you to install Ubuntu dual boot without having to mess up your partitioning.

And – lastly – because you can!

💪 I’m convinced – How do I WubiUEFI up my PC?

Pop over to Hakuna-m’s GitHub page to find the WubiUEFI installer downloads.

A lot of work has been put into supporting a vast array of BIOS and distributions, but before continuing check out this FAQ entry to find out if you have secure boot enabled. If you do, you may want to read the wiki entry on working with secure boot as it may get technical and is not for the faint-hearted.

The links will take you to the release you desired. Download the .exe file from under Assets, and give it a run. Fill in the details of which distro you want, what size and where to store the files, the system will begin to download and prepare your Linux distribution.

If your connection is slow, you may get an error when setup begins. In which case the developer recommends pre-downloading the ISO from the flavour’s website, and keeping it in the same folder as the installer. In which case it’ll use that instead of downloading one.

If all goes well and you reboot, you may end up in the Linux system. Don’t panic! Windows hasn’t gone anywhere – first boot on EFI systems will load up Linux, and subsequent reboots will load Windows first.

Let the installation finish and you’ll now have the option of Windows or Ubuntu on your Windows/UEFI bootloader! Neat!

Bored of Linux? Pop open Uninstall programs and features, and remove Ubuntu. It’s that simple.

There’s no option for Ubuntu on reboot…

Some UEFI systems will handle the OS choice itself, which is especially true of store-bought machines, new motherboards and laptops. When you boot and the manufacturer logo appears, but before the rotating dots do, repeatedly press either Esc, Del, or F12. One combo will eventually boot you into a menu that will ask what you wish to start, with Ubuntu hopefully being an option.

I got a big ol’ Access Denied error

I’ll pass you over to their Wiki page which covers this in detail. Prepare to get technical.


Use Visual Studio Code in your browser, thanks to Azure

Yes, the Electron-based Visual Studio Code – an app built in HTML and JavaScript – is not usable in a web browser. What a weird world we live in.

You may sitting there in your coffee shop, staring with contempt at your weakling tablet and thinking “boy, I wish I could run Visual Studio Code on this powerful lemon”. Well Microsoft apparently listened to you and your gaping wallet. You can now use Visual Studio Code, online!

The aptly named Visual Studio Online – designed to confuse the real Visual Studio developers up and down the land – runs the full Visual Studio Code experience within your web browser. But how, you probably didn’t ask?

Visual Studio Online hooks up to a Azure cloud instance that will run a full copy of Visual Studio Code. Basically, the web version (basically a pseudo-copy) will stream all the changes back to this real copy. Woohoo, programming – Netflix style!

💸But I’m too poor to afford Azure…

Don’t worry, my financially-challenged friend. No regular human can afford Azure.

You can install Visual Studio Online plugin on a computer of choice, and use that as your streamable programming buddy. This means you can use your home PC, a virtual machine, Raspberry Pi, just about anything that can run the latest version of Visual Studio Code.

To do this, you still need a Microsoft Azure account on a minimum subscription of pay-as-you-go. You don’t have to rent out any of their expensive packages, you just need the account to link your remote VSCode setup to.

👀 First Impressions

Microsoft are keen to point out this is insider quality, and is not yet ready for production usage. This is also made obvious by the fact it is not compatible with Firefox. Likely this stems from the regular editor being built upon Electron.

I tried this out by setting up an Ubuntu Hyper-V container, installing Visual Studio Code with Online, and hooking it up to my Azure account.

As far as what I tried, it works just as I would expect the desktop version to work. Extensions all appear to be the same, project and installation settings work (I assume client settings are per-browser, as it lost mine frequently), and the terminal works really well on the existing machine.

This works really well combined with Docker and ngrok, or with a forwarded port open via the home broadband router. All my extensions were compatible, and even Intellisense kept up well despite both a struggling VM and broadband.

This currently isn’t mobile friendly, so don’t expect to do any on-the-fly miracles with your phone. However, this works a treat on tablets for those remote working moments without a primary machine.

I’m really impressed with Visual Studio Online so far, and I can categorically say this will replace my AWS Cloud9 via SSH editor that I used to use.

Any thoughts, or want me to try anything out? Please, let me know via the comments below!