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.
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.
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
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.
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:
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"
Actions > Add Module Mapping and then enter the following:
Request path: *.php
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.
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:
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
To use WordPress just for something like a blog, unzip into your web root, and change the file name:
To have WordPress at the root, move all the files instead the unzipped "wordpress" folder right into your root:
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:
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.
- Add JSON Handler Support
- Add Web Font Handler Support
- Common HTML5 and CSS3 Handler Support
- Configuring RSS with IIS
- How do I change permissions on wwwroot
- PHP.net Installation Docs
- Security Recommendations
- WordPress: Editing wp.config.php
- How to Set Up SSL on IIS 7
- Set up IIS 7 to run a secure site locally - HTTPS
- Tip/Trick: Enabling SSL on IIS 7.0 Using Self-Signed Certificates