Guide For Installing WordPress on IIS
Step by step complete guide for installing WordPress on IIS in a Windows system including detailed prerequisite configurations.

In this post I will walk your through the steps from start to finishing for installing WordPress on IIS. This installation is done on a development system for testing purposes of WordPress functionality on an intranet.

I wanted to be able to work with WordPress in a small controlled environment to edit/test functionality. Do this tests in a working production environment would be risky. I ideally needed to build a test environment. I decided to build a Windows system to host a WordPress site in an intranet using IIS.

At the end of the guide, I will show a few issues I ran into with image uploads and WordPress.org queries.

Disclaimer: Please review necessary file permissions before submitting installation in a production environment.

Install WordPress In IIS

Prerequisites

You will need to install and setup a few things that I will go over in the guide. The list below is in order of necessary install and configuration steps we will follow.

  • IIS
  • PHP
  • MySQL Workbench
  • WordPress

Install IIS on Windows

You will need to install IIS on your Windows system in the Windows Feature window via the Control Panel.

Opening Windows features to enable IIS.

Below is a snapshot of the basics you will need to install.

NOTE: CGI will be used to install and configure PHP to work with IIS in a later step.

Features to enable for IIS install with CGI to integrate PHP.

Now open IIS Manager. We need to ensure the service and site is running.

Opening IIS manager as Administrator.

We will want to test the install and validate we can view the default webpage. Open a web browser and test http://localhost.

Test page displaying to validate successful IIS installation.

Nice. Now lets move onto the next step.

Configure PHP With IIS

Add PHP To System

Adding PHP support is critical when installing WordPress on IIS. This is how the server actively does the background tasks to edit and display pages as well as admin support. We will need to download PHP for Windows. For Windows IIS, the site directs us to us the non thread safe version. Download the zip.

Choose non thread safe PHP version for Windows IIS install.

Find where you downloaded the zip file and extract to a place you want. For my situation, I chose the root drive as shown below.

Extract PHP contents to specific folder.

We will need to edit the system path to include this folder. Go into your System settings and look for the Advanced system settings link.

Open System menu in Windows to open Advanced system settings.

Under the Advanced tab, look for the Environment Variables button

Open Environment variables in System properties to edit Path entry.

Edit the Path variable under the System variables. You will need to create a New entry indicating the location you extracted the PHP zip contents.

Add PHP entry to System variables in Windows.

Now you will need to reboot your system for it to take affect.

Now you need to create a php.ini file. This is the configuration file used for PHP on your system.

  • Copy/paste php.ini-development
  • Rename new copied file to php.ini
Create php.ini file to configure PHP for Windows IIS.

We will come back to this file later. We will move onto configuring PHP in IIS.

Configure IIS To Use PHP

We need to register the .php files in IIS Manager. Click on the Default Document icon in the Default Web Site.

Open Default Document page in IIS manager.

Add index.php

Add index.php to Default Document page in IIS.

We will need to add a handler mapping to use PHP. Click on the Handler Mappings icon.

Open Handler Mappings in IIS.

The mapping will need to point to the php-cgi.exe in the PHP folder. View the image below as a sample on how to configure.

Add FastCgi for PHP support in IIS.

Test PHP Functionality on IIS

Here will will need to create a simple webpage with PHP in it to test the system is working.

On the top of the right pane, click Explore link to open the wwwroot folder for your site.

Default Web Site main dashboard in IIS.

We will need to create a index.php file and add in the following code to test.

<?php
  echo "Hello World!";
?>
<html>
  <body>
    <div>
      <H1>Testing PHP...</H1>
    </div>
  </body>
</html>
Example contents of a test for PHP in IIS.

If everything is successful, you should see the page below when you open a web browser to http://localhost.

Test index.php in web browser to confirm proper PHP integration with IIS.

Add MySQL Support In PHP

To add MySQL support to PHP, we need to edit the php.ini we created earlier. We need to add a support extension.

Note: Any extensions you will need to add to PHP are located in the <PHP path>\ext directory.

Go to the bottom and edit it like the image below.

Edit php.ini to add MySQL support.

Install And Configure MySQL Workbench

In the next steps we are installing and configuring MySQL Workbench on the system. MySQL is essential when installing WordPress on IIS. It is used to hold post and configuration data. You will need to download from MySQL Community Downloads. Choose the bigger MSI, this will add the proper dependencies needed during install.

Downlaod MySQL Workbench MSI installer.

Choose your setup type. I am chose Full.

Choose install type for MySQL on Windows.

The next step checks if your system has the required dependencies installed, if you don't it can add them. Click Execute.

Check dependencies for MySQL on Windows.

Execute again to start the install.

Ready to install MySQL on Windows.

Click Next if everything install properly.

MySQL install successfully completed.

Now its time to configure MySQL. Click Next.

Configure MySQL on Windows for IIS.

I chose defaults for my situation.

Network configuration for MySQL on Windows.

Choose the strong authentication method.

Encryption method for MySQL authentication.

Set your root password for MySQL. You can also setup a database user account here and their privileges which is a good practice for security.

Create root account credentials and new user account for MySQL.

Defaults selected here.

Specify Windows Service for MySQL.

Also choose the default settings.

MySQL server file permissions configuration.

Click Execute to finalize the configurations set.

Apply MySQL server configuration during install.

Click Finish if configurations were successful.

Successful MySQL server configuration during install.

Test the configuration in the next step.

MySQL configuration wizard for IIS.

Enter in account credentials and test connection.

Testing MySQL authentication in Windows installer.

Execute to finalize configurations.

Check of configurations in MySQL Windows installer.

Finish.

MySQL configurations complete.

Click Next to continue.

Final check of applied MySQL configuration for Windows.

Install complete.

MySQL installation complete in Windows for IIS.

Add New Database To MySQL For WordPress

WordPress needs a database to manage all content. Here we will create a new schema just for WordPress.

Login to MySQL Workbench.

Opening MySQL Workbench in Windows to test connection.

After successful login, you will see your console.

MySQL Workbench dashboard after successful login.

In the top Toolbar, look for the icon to Create a new schema in the connected server.

Create a new schema for MySQL.

Give the new database a name. I named this example wordpress.

Create a database for WordPress in MySQL Workbench in Windows for IIS.

Click Apply on next window to create.

Validating MySQL query to create new database for WordPress in IIS on Windows.

Done.

Successfully create new wordpress database in MySQL.

Now the database is ready for WordPress to take over.

Install And Configure WordPress on IIS

Finally, installing WordPress on IIS. First you will need to download WordPress.

Download WordPress from WordPress.org.

Extract the contents of the zip to a location in your web server directory. Ex <system-drive>\inetpub\wwwroot\.

Extract wordpress zip contents to folder in wwwroot for IIS on Windows.

To install WordPress, you will need to navigate to the install.php file in a web browser. Ex. http://localhost/wordpress/wp-admin/install.php

Configure WordPress install in IIS on Windows.

During the installation setup, the wiziard will create the WordPress configuration file based on your input. Use the image below as a reference.

Fill in form fields to configure WordPress install.

Run the installation.

Getting ready to run the installation of WordPress.

Fill in the information in the next screen.

Complete form to finish WordPress install.

Install complete.

Wordpress installation successful.

Click on the Log In link to test your login.

Login dialog for WordPress to test install.

If successful, you will be redirected to your dashboard. To test the default site, go to http://localhost/wordpress.

Validate default WordPress page after successful installation.

WordPress and IIS Image Upload Fix

With a new install, there seems to be no issues with editing page text. There is an issue with image uploads.

  • Image uploads in the Media Library
  • Image uploads dynamically within a post

Also WordPress may have issues with loading the plugins / themes from their server in the Dashboard for your site.

I will show you how to fix these issues. They are permission issues in Windows as well as another needs PHP extension to add to the php.ini.

WordPress Fails To Load WordPress.org Plugin / Theme List

In the image below you can see what the error may look like. The issue is due to WordPress utilizing Curl to get the information from their server. If you see this, then you do not have curl enabled in your PHP.

An unexpected error occurred. Something may be wrong with WordPress.org or this server's configuration.

An unexpected error occurred. Something may be wrong with WordPress.org or this server's configuration.

To fix this, we just need to add another extension to the php.ini file. Open the php.ini file in a text editor or similar and add extension php_curl.php.

Edit php.ini to add php_curl.php for WordPress plugin / theme list issue.
WordPress Windows Temp Permission

IIS in Windows will use the Temp directory for image uploads. The files are temporarily uploaded there first, then when they are complete, they move to destination folder.

Open Windows Explorer and open <system-drive>:\Windows\. Find the Temp folder and right click to go to the Properties.

Locate Temp folder in Windows.

We will add IUSR to the folder with permissions to Read/Write.

Edit permissions of Windows Temp folder to allow user account read/write for WordPress file uploads.

Then we need to edit the php.ini file again to add the php_gd.dll extension for PHP. The GD extension is used when dynamically adding responsive images while editing posts.

Edit php.ini file to add php_gd.dll extension.

Now the image upload should work.

Testing WordPress image upload fix  in IIS on Windows.

All done. Everything should be working now. Hope this was helpful.