Install MySQL, PHP 7, WordPress, with IIS on Windows Server

Recently I have had to set up WordPress on a couple of Windows servers so I thought I would post a walk-through for anyone trying to do the same. I am not going to go into detail on every step as I am assuming you have some knowledge of windows servers and hopefully know your way around.


Step 1 ) Install IIS server with CGI support.

Windows Server 2016 looks just slightly different but the process is the same.

Step 2 ) Download PHP 7 non-thread-safe version from for your architecture either x86 or x64.

Step 3) If you have a 64bit load of Windows (and who doesn’t nowadays) then you need to download both the 32bit and 64bit versions of each of the following Visual C++ runtimes. Download the appropriate version of C++ to support the version of PHP you just downloaded from The version of C++ you need is listed in the description such as VC14 x64 Non Thread Safe PHP 7.1 (7.1.9). With this download, you need to download and install VC14 which is Visual C++ 2015. The visual C++ versions are listed on the left side of the above page along with the links to download the x86 or x64 version of each. You can grab the 32-bit or 64-bit version of VC14 here.

Step 4) Download Mysql Community Server from The installer is 32-bit but installs either the 32-bit or 64-bit version of MySQL depending on your system. You DO NOT have to register or sign up to download MySQL. Just choose the option “No thanks, just start my download.” at the bottom of the download screen.

Step 5) Download Wincache 2.0.x to enable caching on your server from Make sure you get the 2.0.x version that matches your version of PHP (7.1, 7.2) or else you will get errors. At the time of this article, wincache requires visual C++ 11 to be installed. You can grab the 32-bit or 64-bit version of VC 11 here.

Step 6) Download URL rewrite for IIS

Now that you have IIS with CGI support installed and all of your other files downloaded, let’s set up Visual C++, PHP 7, and MySQL.

Installing Visual C++

Step 7) Install required Visual C++ versions.

  1. Double click on each visual C++ package you downloaded and install it. You should be installing 3 versions of C++.

Installing PHP

Step 8) Install PHP and Wincache Manually

  1. Extract all files in the PHP .zip package to a folder of your choice, for example, C:\PHP7\.
  2. Extract Php_wincache.dll from the wincache- exe you downloaded to the PHP extensions folder (\ext), for example, C:\PHP7\ext.
  3. Open Control Panel, click System, and then click Advanced system settings.
  4. In the System Properties window, select the Advanced tab, and then click Environment Variables.
  5. Under System Variables, select Path, and then click Edit.
  6. Add the path to your PHP installation folder to the end of the Variable value, for example;C:\PHP7. Click OK.
  7. Open IIS Manager, select the hostname of your computer in the Connections panel, and then double-click Handler Mappings.
  8. In the Action panel click Add Module Mapping.
  9. In Request path, type *.php.
  10. From the Module menu, select FastCgiModule.
  11. In the Executable box, type the full path to Php-cgi.exe, for example, C:\PHP7\Php-cgi.exe.
  12. In Name, type a name for the module mapping, for example, PHP7 FastCGI.
  13. Click OK.
  14. Select the hostname of your computer in the Connections panel and double-click Default Document.
  15. In the Action panel, click Add. Type Index.php in the Name box, and then click OK.
  16. Click Add again. Type Default.php in the Name box, and then click OK.
  17. Open your PHP directory and find the php.ini-production file.
  18. Rename the file to PHP.ini. Now in order to make PHP work on windows, we need to make a few changes to this file so open PHP.ini in notepad or the text editor of your choice. Find and uncomment the following lines in PHP.ini by removing the semicolon from the beginning of the line and changing the settings as shown below:

cgi.force_redirect = 0
fastcgi.impersonate = 1
Set extension_dir to the ‘ext’ folder in the PHP folder (i.e. ‘C:\PHP7\ext\’).
max_execution_time = 180 (you may have to adjust this time depending on any PHP scripts or backup programs that need a longer runtime than the default 30 seconds)
memory_limit = 256M (adjust as needed, I set mine up to 256M for WordPress plugins to use)
date.timezone should be set to the time zone of your server (eastern would be America/New_York – You can find a list of appropriate values at
opcache.enable=1 (turns on Zend Opcache)
Go to the bottom of the file and add the following

[WinCache] ; Full reference:
wincache.fcenabled = 1
wincache.ocenabled = 1
wincache.ucenabled = 0
wincache.fcachesize = 64
wincache.fcndetect = 1
wincache.maxfilesize = 256
wincache.chkinterval = 10
wincache.enablecli = 1
wincache.ucachesize = 8
wincache.scachesize = 8

In order for PHP to function with MySQL, you will also need to uncomment the following lines in the Windows Extensions section.

extension=php_curl.dll (Enables WordPress to retrieve and display product news updates. If disabled, you’ll see an error message in admin every time you log in.)
extension=php_mbstring.dll (Multi-byte string – required by some programs)
extension=php_mysql.dll <– no longer needed??
extension=php_mysqli.dll (Mysql database support)
extension=php_gd2.dll (Enable to see PHP charts)

[PHP_WINCACHE] extension=php_wincache.dll (Enable to use wincache caching) (These two lines won’t exist so just add them to your PHP.ini file as shown.)


Step 9) Test your PHP installation

  1. Open Notepad as Administrator.
  2. Type the following <?php phpinfo(); ?>
  3. Save the file as C:\inetpub\wwwroot\phpinfo.php.
  4. Open a browser and enter the following URL: http://localhost/phpinfo.php
  5. You should see a page showing you your current PHP settings if everything is working correctly.


Step 10) Installing MySQL

  1.  Update 2/9/19 – If you are installing MySQL 8 you need to read this follow-up post first! 
  2. Extract the files from your MySQL download and run setup.
  3. You only need a few things from the installer so chose the Custom setup type from the first screen. Choose the version of the server itself (x86 or X64), MySQL Workbench, and Notifier, which you can use to alert you to any change in the server’s status.
  4. Click Next
  5. Click Execute and wait for everything to install. If you didn’t install all of the Visual C++ components earlier, you might need to install the Microsoft Visual C++ 2013 Runtime in order to complete the installation. The Installer will notify you of this or any other failing requirements and give you the chance to fix them without stopping the installation.
  6. Click Next
  7. Click Next 3 times until you get to Type and Networking.
  8. Choose Server Machine (Server Computer for MySQL 8.x) for the config type.
  9. Click Next
  10. On the Accounts and Roles screen, you need to enter a Root password. I suggest you make this something unique and hard to guess and be sure to WRITE IT DOWN SOMEPLACE where you can find it that’s NOT on the Web server.
  11. Click Next
  12. Leave the defaults as they are shown below. Click Next
  13. Click Next
  14. Now on the last screen Click Execute to get all of this stuff configured.
  15. If everything went well you will have a green checkmark beside each step.
  16. Click Finish
  17. Click Next
  18. Click Finish again to exit the MySQL installer.
  19. After the installation finishes, it will open MySQL Workbench where you will probably get the following error message. You can just ignore this message.
  20. Click on the part of the screen where it says “root localhost:3306” and you should get a sign-in box.
  21. Hopefully, you remembered and wrote down the root password you created earlier. Enter it in the password box now to make sure that you’re able to log in to your new database server.
  22. Next, we need to create the WordPress database and user. You can do this from MySQL Workbench or the MySQL command line. MySQL can be managed either from MySQL Workbench or from the MySQL command-line client. I am going to show you how to do it from the command line just because it is quicker and easier and I only have to take one picture!
  23. Open the MySQL 5.7 Command Line Prompt from the Start menu and type in the password that you set for the MySQL root account.
  24. Update 2/8/19 *** WARNING! If you installed MYSQL 8.x view this updated post before you proceed to the next step! ***
  25. Now we are going to create the MySQL database for WordPress to use and create a user and give them full access to this database. Type the commands exactly as seen below but change yourdatabasename to whatever you want to call your database and yourwpuser to whatever username you want and password to whatever password you want to use. NOTE: If you copy the lines below, you will have to change the single quote ‘ character after you paste it into a document on your computer as the font on this site changes it to an invalid character for MySQL. It is a single quote, the one below the double quote on most keyboards.
        1. CREATE DATABASE yourdatabasename;
        2. USE yourdatabasename;
        3. CREATE USER ‘yourwpuser‘@’%’ IDENTIFIED BY ‘password‘;
        4. grant all privileges on yourdatabasename.* to ‘yourwpuser‘@’%’;
        6. Type ‘exit’ to leave MySQL and then ‘exit’ again to exit the command prompt.

      With these commands, you create a WordPress database and set it as the default in your MySQL session. Then you create an administrative user for WordPress and grant that user all privileges on the WordPress database. You will need this username and password later when we install WordPress. WRITE IT DOWN SOMEPLACE where you can find it that’s NOT on the Web server.

Step 11) Configuring IIS for WordPress

Before we can install WordPress, we need to make a few changes to permissions on IIS in order for WordPress to install and to update plugins and such after it is up and running.

  1. Browse to C:\inetpub and right-click on wwwroot.
  2. Click on properties
  3. Click on the Security tab.
  4. Click the Edit button.
  5. Click the Add button.
  6. If your server is on a domain, you will need to click the Locations button, enter your name and password, then click on the server name at the very top of the list before attempting the next step.
  7. Enter IUSR in the object names box and press OK.
  8. With IUSR highlighted, click on the Modify box which will place a check beside all of the permissions except Full Control, and click Apply then OK.
  9. Install the URL Rewrite program you downloaded from Microsoft at the start of this article.

Step 12) Installing WordPress

The last step is to install WordPress on your IIS web server. The latest version can be downloaded directly from ( The installation is very easy and fast. They have a “famous 5-minute install”. So let’s get to it.

  1. Unzip the file you downloaded from WordPress into your c:\inetpub\wwwroot folder or you can create a subdirectory in the wwwroot folder and put all the WordPress files in this folder in case you want to install other sites on this server.
  2. Rename the wp-config-sample.php file in the WordPress directory and name it wp-config.php. Open this file in notepad and change the following settings, substituting the MySQl database username and password that you created earlier. Replace the fields in red below with your info.
  3. /** The name of the database for WordPress */
    define(‘DB_NAME’, ‘wordpress‘);
    /** MySQL database username */
    define(‘DB_USER’, ‘username‘);
    /** MySQL database password */
    define(‘DB_PASSWORD’, ‘password‘);
    /** MySQL hostname */
    define(‘DB_HOST’, ‘localhost’);
  4. After you’ve made these changes, open your browser and go to your website address. For example If you extracted WordPress into another folder be sure to adjust the URL accordingly. This will start the WordPress installation script in the PHP file. For example
  5. You should be greeted with a language selection to get started. Choose your language and click Continue.
  6. Click Let’s go!
  7. Enter your Database name (you already created it earlier), username, and password for the Database (created earlier). You can change the table prefix if you want, but you don’t need to unless you are going to be using more than one WordPress site. Click Submit NOTE: The page below will not show up if you manually edited the above wp-config.php file.
  8. Click Run the install.
  9. Enter your Site Title. Create a username and password for the administrative user for WordPress. Use only strong passwords (long with special characters included) because this part is accessible from the internet. WRITE THE NAME AND PASSWORD DOWN AND SAVE IT SOMEPLACE YOU CAN FIND IT! Click Install WordPress.
  10. If all goes well you should see Success! Click Log In.
  11. You will now be taken to the administration part of your WordPress installation (login with the user and pass just created).
  12. And here you are at the backend of your new site. This is the default page for the administrator when they log in.
  13. Now if you enter localhost or your site’s web address in your browser you should see the default WordPress page.
  14. Delete install.php from your WordPress/wp-admin folder after the install finishes.

The rest is up to you! Happy WordPressing! PHEW!

I have posted a follow-up article on fixing some common problems with WordPress on Windows Server IIS. Click here to view.

I have posted a second follow-up article that covers using MySQL 8 with WordPress.  Click here to view.

About The Author

I have worked in the computer repair field since the early '90s. I was a technician and then Coordinator of Computer Repair for Regional Education Service Agency II (RESA 2) for 18 years. I currently work for Wayne County Schools as a Network Engineer/Technology Specialist. I am responsible for the schools' Internet access, Wi-Fi, networks, servers, laptops, desktops, and operating systems and software.

Related posts


  1. sebastian


    thanks for this article, i followed it, but i get an error when i try to access wordpress site, it says table does not exist. i have looked with phpmyadmin, but no tables were created in the database, any ideas?

    kind regards,


    1. Mark Scarberry

      If you can see the database you created with PHPMyAdmin and there are no tables then your problem is around where you are installing WordPress. Check “Step 12) Installing WordPress” and make sure you have the correct database name, user name, and password. You should have gotten an error trying to install WordPress if you had the incorrect info and should not have seen the SUCCESS message after attempting the WordPress install.

  2. Vince

    I had to use the following commands to make it for with MySQL 5.7 with WordPress 5.2.3:

    CREATE USER ‘yourwpuser’@’localhost’ IDENTIFIED BY ‘password’;

    GRANT ALL PRIVILEGES ON yourdatabasename.* to ‘yourwpuser‘@’localhost’;

    The installed failed showing all the SQL commands saying the user did not have privileges to perform the command.

  3. Tim Smith

    After spending a day to try and set this server up on my own I found and followed you directions and it worked perfect with no problems. Awesome article which saved me many hours of work and research.


Leave a Reply

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

3 + = 7