Setting Up a WordPress Development Environment on Windows



Let’s face it, in today’s information age, content is king. To put it more accurately, anyone trying to be a successful on the interwebs needs to quickly create and present great content. Therefore, content management systems (CMS) are heavily used. I don’t know how accurate this is but it has been said that WordPress is the most user-friendly and most used CMS on the internet. However, WordPress has been traditionally hosted on Linux servers. It should be no surprise that I am a Windows user and host everything on Microsoft Azure. Per my previous post and thanks to Azure’s new MySQL services, you can host a WordPress in Azure’s App Service which is actually an instance of Internet Information Services (IIS).

Where I am

So, here I am a Windows user with a background in .NET and I have a WordPress on Azure which uses IIS and MySQL. Unfortunately, most of the features available in WordPress just do not meet the needs of, well, anyone. There is always a need to add plugins and create themes. Think about it, you have authentication, SEO, email/SMTP and marketing plugins and if every website looked the same the internet would be boring. In addition, themes out-of-the-box are too simplified. Now, many of the plugins and themes are free until you want to customize to your liking and then you pay and it is ridiculous. Yes, I am calling your overpriced plugins or themes ridiculous. Accept it. I get it, everyone needs to make a living but for small businesses and users your pricing models are excessive.

Side Note

I imagine you are getting a sense of my frustrations with WordPress. But before you ask, I have used project nami which is a great platform if you don’t mind waiting to use some plugins following a new release of WordPress. Additionally, I have used other .NET Framework blogging engines but the development efforts have been extensive because of the lack of plugins or themes. Lastly, the market for good WordPress plugins and themes is HUGE because everyone seems to want a WordPress and everyone seems to build poor themes and plugins. As a result, I ultimately chose WordPress, that is, until the new version of Orchard is available, wink, wink.

Anyway, fortunately, I am a developer and can build plugins and themes myself. Because, as the adage goes, if you want something done your way then do it yourself. (I know that is not the actual adage but this is the more honest form) This brings me to the purpose of this post. After a few months of using WordPress I need a way to develop plugins and themes. But remember, I am a Windows user with my WordPress on IIS. So, let’s get started building a WordPress development environment on Windows.


What you Need:

Short Version

  1. Download and Install
    1. Visual Studio Code
    2. Web Platform Installer
    3. WordPress Source Code
    4. MySQL
      1. Note: always create a username and password during your install for admin on your dev MySQL; do not use root.
    5. MySQL Workbench
  2. Install IIS from the Windows Features option in Windows 10
  3. Install PHP from Web Platform Installer
    1. Note: There is an issue with the PHP Manager for IIS that requires a registry hack
  4. Unpack WordPress to specified dev folder
    1. Create phpinfo.php and debug.ini files for development purposes
      1. Debug.ini contains db connection using custom wp-config.php, see below for details
  5. Create Web Application in IIS
    1. Point it to your dev folder for WordPress
    2. Add SSL binding and dev cert when creating IIS application
      1. Just make a habit to NOT EVER OPERATE A WEBSITE WITHOUT SSL.
  6. Edit host file in C:Windows\System32\Drivers\etc folder with binding from IIS web application

Long Version

  1. Download and Install all the goods (see above)

  2. Install IIS

Getting to Windows Features:

Hit your Windows Key + S and search for features to turn on additional Windows features

Click the Internet Information Services check box.

NOTE: You don’t need EVERYTHING under this node. Just click it once and all that you need will be included

Install IIS

Just let it do its thing. Once complete you can open IIS by searching for IIS and opening the IIS Manager app

  1. Install PHP and PHP Manager

Open WPI (Windows + s) and search for web

When you install PHP from WPI it includes everything you need. Thank you, Microsoft!

NOTE: There is an issue with the PHP Manager for IIS that requires a registry hack

I don’t endorse hacking the registry and it could damage your machine. Just a heads up, you do this at your own risk.

  1. Unpack WordPress into specified dev folder

Add phpinfo.php and debug.ini to dev folder

A note on these files:

  1. The files should only be used in development, seriously. Keep them out of your source code.
  2. The phpinfo.php file is for checking your server settings. It is one line of code.
  3. The debug.ini file contains your development server info to read into your wp-config.php file.

    Before you launch the application make sure you create the database schema in your MySQL instance.

  4. Just download and use this wp-config.php file instead of the file included in the source. Delete the wp-config-sample.php file too.
    1. The wp-config.php file is so that you can deploy your WordPress on any server and read settings from the server config there.
    2. If you use git for source control, be sure to add the 2 files to your .gitignore. DO NOT DEPLOY THEM!
  1. Create the Application in IIS

Right-click add website in IIS manager

Create a name for your site, add the physical path and ensure you use https and create a host name

Edit the hosts file

Add the ip: and the host name you chose above.



You can now launch your development WordPress website. After the initial setup you will be at the admin dashboard and ready to go. With the exception of the PHP Manager bug, it is actually pretty simple and there are other ways to do this but doing it this way keeps everything nice and tidy; no additional programs to install and I can just copy each new WordPress build over the existing files. Anyway, I will most likely be moving off WordPress at the beginning of next year and will probably start developing on Orchard Core before then but this is here for anyone that needs it and my reference should I come back to WordPress. If you have any questions please don’t hesitate to reach out. Happy building!


Migrating a WordPress DB from MySQL in-app to MySQL on Azure


Let me tell you a secret. I have been running my blog on the MySQL in App instance provided with each Azure App Service web application for the last few months. Yes, I know that is not a best practice. However, I didn’t want to have to do the ClearDb or host a Linux VM options and I knew Azure would have a MySQL service someday. Today, 5/10/2017, Microsoft announced a new service available in-preview on Azure. They are offering a Database-as-a-Service (DBaaS) for MySQL and PostgresSQL in addition to the SQL Server service. Get excited! You can read all about the service, pricing and documentation here. This post is about migrating a WordPress db from the MySQL in App instance to this new service. You can read more about the in-app instance here, but the goal of the in-app feature was only for development. Hence, the need to migrate, asap.


Software Tools

  1. Any web browser
  2. Visual Studio Code
  3. MySQL Workbench
  4. Any ftp client
  5. Optionally, phpMyAdmin


  1. Assumptions and Preparations
  2. Create an Azure Database for MySQL
  3. Export and Importing the Existing Database
  4. Deploy WordPress to Staging Environment
  5. Swap Production and Staging Environments

Let’s begin.

Assumptions and Preparations

I am assuming a couple of things about the audience for this post. First, that you have a valid Azure subscription and know what PaaS means. Second, you are familiar with administering a WordPress blog running in an Azure App Service using the Standard pricing tier.

This last bit of preparation is configuration. Let me start by saying, configuration management is difficult even for small apps. I originally deployed this app with the idea of only having a staging site and a production site. However, this was not feasible as there was some weird issues with the MySQL in-app between the 2. As a result, I just use my development environment as the testing ground before production. Additionally, I don’t install any plugins in dev they are all installed in prod, backed up and copied down to dev. Anyway, I originally configured the wp-config.php file to dynamically read the server environment variables so that I wouldn’t have to reconfigure each environment. Because that is a pain. Below is the code I used for this. Once I got this working it was nice not to have to remember configuration settings for each environment. You are welcome to use this. If you only have one deployment I don’t think you will have to but you can. Here is a gist for you.

custom wordpress config file

Create an Azure Database for MySQL

This step is simple enough. Just search for the service and follow the prompts. However, once the database completes deploying there are 2 things required.

  1. Ensure the force SSL is disabled.

    azure enable ssl settings

  1. Add a firewall rule to allow all IP’s. This was s setting I discovered by creating a Web App + MySQL test application in Azure from the Marketplace.

    azure mysql db firewall settings

Exporting the Existing Database

There are 2 options, maybe more and not even one is better than the next. I will discuss the options I tried and note the one that I went with because it’s easier.

Option 1: Using phpMyAdmin

This is the less preferred method because I am not really a fan of phpMyAdmin but it is the method provided in the WordPress codex here.

phpmyadmin export tables

Exporting this way will provide you with a SQL file that you can then run against your new database.

NOTE: This script shows creating the database. Just manually create your database in your new SQL Database for MySQL via MySQL workbench. Also, don’t use localdb. That is for demo purposes.

phpmyadmin export sql file

Option 2: Using the Azure Portal

This is the preferred method and extremely simple. It’s like the Azure devs knew that the in-app instance would need an export function. It’s as simple as just entering the security credentials to the MySQL Server and clicking a button. So, here are some pictures for reference.

Note: I initially had an issue with connecting to the SQL database for MySQL doing this. However, I disabled the force SSL and added the firewall rule and it worked seamlessly.

azure mysql in app export

azure mysql in app export form

azure mysql in app export screen

Deploy WordPress in Staging Environment

This next step you’ll want to test out your work to see if all went well. Luckily, Azure App Service has an excellent feature for that; deployment slots. It’s easy to create a deployment slot. In the production app blade select the section for deployment slots and add a slot. I cloned the source configuration so that things would be identical to test out.

azure create web app deployment slot form

azure web apps deployment slot screen

In the staging deployment turn off the MySQL in App feature.

disable azure web app mysql in app

Also in staging, delete the old application settings specific to the MySQL in App instance and add your connection string. The format of the connection string is Database={dbName};Data Source={dbHost};User Id={userName};Password={password}

delete azure web application settings

This next step requires and FTP client. I use FileZilla but whatever your preference is will work fine. Make sure to configure the ftp client to connect to production and staging. Connect to production and download the production WordPress application code.

filezilla file download

Now, connect to staging and upload the application code.

filezilla ftp file upload

In the wp-config.php file, ensure the database connection string key matches the key from the application settings. Reupload the wp-config.php file via ftp client, if necessary.

wordpress config settings file

Test the staging URL and make sure everything works. Click links, read posts, etc. If all goes well, move to the last step.

Swap Production and Staging Environments

Swap staging and production. This is easy enough, just click the swap button via the staging or production website overview blade. Below is a sample of what the swap button looks like.

azure web app deployment slot swap


Migrating a database is easy in MySQL and I really enjoyed using the MySQL Workbench tool. Additionally, now the site is scalable. Where before it wasn’t because each MySQL in-app instance was unique to the website instance. Meaning, if the site scaled to 100 instances there would also be 100 MySQL in app instances. This alleviates this issue. However, I doubt many users will need to do this but it is documented here. Enjoy.