MediaWiki on IIS

by Eric Woersching


The following sections describe how to install and configure MediaWiki for use with FastCGI on Windows Server® 2008. This document assumes that you have completed the setup and configuration of the FastCGI extension and PHP libraries as described here.

The instructions have been tested and found to work in the following configuration:

  • Windows Server 2008 RC0
  • IIS 7.0
  • PHP 5.2.4 Non-thread-safe Win32 binaries (RC2-dev)
  • MySQL 5.0
  • MediaWiki 1.11.0

Notes on PHP Setup

  1. Change the default session, upload folders and grant access to the built-in IIS_IUSRS group.

  2. Open a Command Prompt window with administrator privileges and run the following commands:

    cd /d C:\php (i.e. the location of your php root directory)
    md session
    md upload
    icacls session /grant BUILTIN\IIS_IUSRS:(OI)(CI)(M)

    From the base configuration file provided by PHP, you will need to modify your php.ini to have the following definitions:

    session.save_path = "C:\php\session"
  3. Enable PHP support for MySQL. Modify your php.ini to define the extensions directory and uncomment the PHP MySQL extension definition:

    extension_dir = "C:\php\ext" (i.e. the location of your php extensions directory)

Download and Unpack MediaWiki

The latest release of MediaWiki is found at The instructions in this document are based on version 1.11.0, but future versions are likely to be very similar as far as installation is concerned.

  1. After downloading the GNU zip package, extract its contents to %SystemDrive%\Inetpub\wwwroot\MediaWiki or another directory of your choosing.

  2. Modify the permissions for the MediaWiki config folder and grant Write permissions for the built-in IIS_IUSRS group.

  3. Open a Command Prompt window with administrator privileges and run the following command:

    icacls %SystemDrive%\Inetpub\wwwroot\MediaWiki\config /grant BUILTIN\IIS_IUSRS:(W)

Configure MediaWiki

  1. Begin the graphical MediaWiki installation procedure by pointing your browser at http://localhost/mediawiki/config/index.php. You see the following screen.

    Screenshot of the Media Wiki installer Environment checks.

  2. Scroll down the window and configure your Wiki name and all the required fields. In the Database config section, enable the 'Use superuser account' checkbox and enter the database superuser password.

    Screenshot of the Media Wiki installer Database config. The checkbox next to Use Superuser account is checked.

  3. Once you enter all the required information, click "Install MediaWiki!". The configuration page creates the database wikidb and saves your settings in the %SystemDrive%\Inetpub\wwwroot\MediaWiki\config\LocalSettings.php file.

    Screenshot of the Media Wiki installer install complete page. The text on the page says Installation successful!

  4. Move the LocalSetting.php file to the %SystemDrive%\Inetpub\wwwroot\MediaWiki\ folder and delete the folder %SystemDrive%\Inetpub\wwwroot\MediaWiki\config from your system.

  5. LocalSetting.php contains sensitive information, so secure it by revoking access to unnecessary identities. Open a Command Prompt window with administrator privileges and run the following command:

    cacls %SystemDrive%\inetpub\wwwroot\MediaWiki\LocalSettings.php /sddl:"D:PAI(A;;FA;;;SY)(A;;FA;;;BA)(A;;FA;;;NS)"

    The previous command grants access only to the following identities:

    • SYSTEM
    • BUILTIN\Administrators group
    • Network Service
  6. The installation is complete. Point your browser to http://localhost/mediawiki/config/index.php.

    Screenshot of the Media Wiki main page after installation. The text on the page says Media Wiki has been successfully installed.

Testing the Application

For testing MediaWiki, create a user and modify the Main Page content.

  1. Navigate to http://localhost/MediaWiki/index.php.

  2. Click the Log in / create account link in the top right corner.

  3. Click the "Create an account" link.

  4. Enter the username and password and click "Create account".

    Screenshot of the Media Wiki Log in and Create Account page. Boxes for Username, Password, Retype Password, and Real name are shown.

    Screenshot of the Media Wiki showing First User having been created. The text says Welcome, First User!

  5. Go to the main page and click the Edit link. An Editor displays in which you can make your changes. When done with changes, click "Save Page".

    Screenshot of the Media Wiki editor for the Main Page.

Here is the modified page.

Screenshot of the Media Wiki page post edit. The text says Media Wiki running on I I S seven.

Enabling clean URLs with URL Rewrite Module

When hosting MediaWiki on IIS 7.0, it is possible to configure MediaWiki to use URLs without query string by following these steps:

  1. Install Microsoft URL Rewrite Module for IIS 7.0

  2. Create a web.config file in the same folder where MediaWiki files were installed and paste into it the following

    <?xml version="1.0" encoding="UTF-8"?>
                    <rule name="MediaWiki">
                        <match url="^(.*)$" />
                            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                        <action type="Rewrite" url="index.php?title={R:1}" />
  3. Update the LocalSettings.php file as follows:

    ## The URL base path to the directory containing the wiki;
    ## defaults for all runtime URL paths are based off of this.
    ## For more information on customizing the URLs please see:
    $wgScriptPath       = "/MediaWiki";
    $wgScriptExtension  = ".php";
    $wgArticlePath = "${wgScriptPath}/$1";

Getting More Information

To discuss the FastCGI support in IIS, or file bug reports, use the FastCGI forums:

To get more information regarding running various PHP applications on IIS, refer to: