Skip to main content

Creating a development environment for IIS 7+

This post describes how to enable IIS on Windows 7, along with enabling MySql and Php. You will need Administrator Access to complete these steps.

Enable IIS

In order to avoid permission issues when trying to edit a file with your logged in account, create a folder in a directory outside of innetpub, ensuring that the full path has no spaces.

For example: C:\webroot\

Next, to fix the security settings, right click on the new folder and add permissions for any users with, ISR, IUSER and Networking (full access)

Now, use the following guide to install IIS onto your machine. After first enabling, it will have your web root in the innetpub folder.

Since our folder is created, lets go ahead and relocate the server to use that!

Go in to the Default Web site and click: Default Web Site > Manage Web Sites > Advanced Settings > Physical Path. Modify the path to be at the location you created at the top of this step.

Install PHP

Go back into the "Turn Windows Features on or off" menu, then expand the category "Application Development Features". Finally, enable the "CGI" check box.

Download the latest stable version for PHP (Non Thread Safe) and unzip into a directory so that the path is similar to: c:\PHP5

Next, rename "php.ini-production" to "php.ini". Open the file, and edit to match the items below:

extension_dir = "C:PHP5ext"
log_errors = On<
error_log = "C:inetpub	empphp-errors.log"
fastcgi.impersonate = 1
fastcgi.logging = 0
cgi.fix_pathinfo=1
cgi.force_redirect = 0
display_errors = Off
upload_max_filesize = 8M
post_max_size = 8M

Now, in the IIS manager, left click once on your server name, and then select "Handler Mappings"

Click Actions > Add Module Mapping and then enter the following:

Request path: *.php
Module: FastCgiModule
Executable: c:\PHP5\php-cgi.exe
Name: PHP_via_FastCGI

In the same Window, Click Request Restrictions > Mapping. Next, check off "invoke handler only if request is mapped to", then click "File or Folder". Now, click "OK" in all dialog boxes to accept changes.

In the IIS manager, click on your Default website, and then "Default Document", and then add index.php to the list.

Finally, restart your Default Web Site, and check out the "Security recommendations" link in the Resource section for more ways to secure this instance.

Install MySQL

Download the latest stable version (at the time of writing, 5.x), but be sure to just skip to the download (near bottom of page). July 21, 2021 note: if you use PHP version 5.6 or below, MYSQL will not function well with MYSQL 8.

For most uses the Typical install is fine. Please select all the MySQL defaults, and be sure to set a strong default password for root.

Note: Never use root on any of your Web applications.

Next, go into your php.ini file and uncomment:

extension=php_mysql.dll
extension=php_mysqli.dll

Save, then restart your IIS server.

Lastly, create a mysql user and database. Be sure to use a strong password here as well.

Install the URL rewrite plug-in for IIS

Go to the Microsoft Site to download the latest version.

Once installed successfully, restart the server again.

This step will allow you to use "Pretty URLs" on your blog.

Download and install WordPress

From WordPress.org download the latest versions (4.1.1 at the time of writing). Also, check out the translations to download WordPress in your language, though some of these ay not be the latest.

To use WordPress just for something like a blog, unzip into your web root, and change the file name: C:\webroot\blog

To have WordPress at the root, move all the files instead the unzipped "wordpress" folder right into your root: C:\webroot\

Next, edit the file "wp-config.php" (you may need to rename the sample config). Change the WordPress user name, password, and database to match what was created after installing MySql.

Open up the secret generator to automatically generate your secret keys. Paste this into your wp-config.php file.

Next, add the below line (to stop WordPress from asking your ftp information) and paste just above the comment that asks you to stop editing:

define('FS_METHOD','direct');

Never use this external servers!

Save all these changes, then run one of the below addresses in your browser.

Go through and set up your site name, and admin user as suggested on the page.

For issues, consult the WordPress Docs.

Add Mime Types to IIS

If you are not able to see content such as: fonts, JSON, videos, etc., you may need to add the mime type to your "web.config" file as seen below. Instead of adding to your web.config, this can also be done in the IIS server itself.

<?xml version="1.0"?>
<configuration>
    <system.webServer>
        <staticContent>
          <mimeMap fileExtension=".json" mimeType="application/json" />
          <mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" />
          <mimeMap fileExtension=".otf" mimeType="font/otf" />
          <mimeMap fileExtension=".ttf" mimeType="application/octet-stream" />
          <mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
          <mimeMap fileExtension=".woff" mimeType="application/font-woff" />
          <mimeMap fileExtension=".woff2" mimeType="application/font-woff2" />
          <mimeMap fileExtension=".mp4" mimeType="video/mp4" />
          <mimeMap fileExtension=".m4v" mimeType="video/m4v" />
          <mimeMap fileExtension=".ogg" mimeType="video/ogg" />
          <mimeMap fileExtension=".ogv" mimeType="video/ogg" />
          <mimeMap fileExtension=".oga" mimeType="audio/ogg" />
          <mimeMap fileExtension=".spx" mimeType="audio/ogg" />
          <mimeMap fileExtension=".svg" mimeType="images/svg+xml" />
          <mimeMap fileExtension=".svgz" mimeType="images/svg+xml" />
          <mimeMap fileExtension=".appcache" mimeType="text/cache-manifest" />
          <mimeMap fileExtension=".rss" mimeType="application/rss+xml" />
     </staticContent>
    </system.webServer>
</configuration>

If they are not above, they may be mentioned at: List of Common MIME types.

Resources: