Thursday, July 17, 2008

Walktrough for mediawiki on Windows IIS - The gory details

I have the following setup:

Windows Server 2003 with Inernet Information Server 6 (IIS 6) running. So installing Apache is not an option.

First of all.

It works with no limitation. Even with complete Email-Support.

For running mediawiki you need:

mySQL (I used 5.0.51)
the MySQL GUI Tools
Php (I used 5.2.6)
mediawiki of course 1.12)
FastCGI for IIS 6
DiffUtils for Windows (Optional but useful)
ImageMagick (Optional)

A. Install ImageMagick

Just run the installer and remeber the path.

B. Install DiffUtils

Just run the installer.

1. Install FastCGI

Simply run the installer

2a. Install mySQL

Simply run the installer. Not much to do here. Remember the Password of the "root" user. You will need it later to autocreate the mediawiki Database.

2b. Install the MySQL GUI Tools
Simply run the installer.

3. Install PHP


This is more tricky.

When asked for the Web Server Setup choose :


I chose the following Extension (do not select all):



Enable the following Extra

Pear Install

After setup completed


Modify php.ini

Under Start - Programms - PHP 5 you find php.ini

Edit the following parameter:

fastcgi.impersonate = 1;

Modify fastcgi configuration fcgiext.ini file for php support

Click Start - Run and slap in


Open fcgiext.ini in Notepad and add at the bottom


ExePath=D:\Program Files\PHP\php-cgi.exe

Make sure the Exepath reflects the path to your PHP installation!

If you get the error:

FastCGI Error
The FastCGI Handler was unable to process the request.

Error Details:

* Could not find entry for "php" on site 1 in [Types] section.
* Error Number: 1413 (0x80070585).

* Error Description: Invalid index.

HTTP Error 500 - Server Error.
Internet Information Services (IIS)

you did not edit fcigext.ini properly

See also the full description here

Install MediaWiki to IIS


Create a directory for you wiki under the wwwRoot Dir of IIS ( I used "wiki" in this case)

Extract the mediawiki-1.12.0.tar.gz to the "wiki" IIS directory.

Modification of config/index.php installer script

If you installed the DiffUtils:

Go to the wiki/config/ directory and edit the file index.php

Find the line:

$diff3versioninfo = array( '$1 --version 2>&1', 'diff3 (GNU diffutils)' );

and replace with:

$diff3versioninfo = null ;

If you get the Message:

PHP Warning: shell_exec() []: Unable to execute 'D:\Program Files\GnuWin32\bin\diff3.exe --version 2>&1' in F:\secureinet\wwwroot\wiki\config\index.php on line 1824

you did not edit this line.

If you installed the ImageMagick:

Go to the wiki/config/ directory and edit the file index.php

find the line:

$imcheck = array( "/usr/bin", "/opt/csw/bin", "/usr/local/bin", "/sw/bin", "/opt/local/bin" );

and replace it with

$imcheck = array( "", "D:/MYPATH/ImageMagick-6.4.2-Q16", "/usr/local/bin", "/sw/bin", "/opt/local/bin" );

Remember to replace MYPATH with the correct path and to turn Backslash \ into Slash /

find the line

$im = "$dir/convert";

and replace with:

$im = "$dir/convert.exe"

Configure the wiki directory settings in IIS

Start - Settings - Administrative Tools - Internet Information Services

Configure the "wiki" directory appropriatly. To be honest I just enabled everything:

Script source access, Read, Write,Directory Browsing and Execute Permissions on Script and Executables.

For me it is fine as I use the wiki in the intranet. For Internet usage this could be potentially insecure. Post a comment if you know what the best settings are.

Edit the permissions on the config Directory.

In explorer go the wiki directory

Configure file permissions by rightclicking the "config" directory, go to the security tab and add "Everyone" with Permission "Full Control". The directory should be deleted anyway after the installation so it does not matter.

If you get the error message:

PHP Warning: fopen(LocalSettings.php) [function.fopen]: failed to open stream: Permission denied

you do not have permissions to write the file.

Create the mediaWiki

Now start the Browser and slap in the URL


If you have installed diff and ImageMagick it should come up with the message that they have been found.

  • Choose a name for your wiki
  • Enter a wiki admin Password (and remember it)
  • Disable all Email Options including email authentication (they won't work out off the box. All options can be enabled later)

  • a Database Name
  • a Wiki Database Username and Password.

If the user and database do not exist, you must check the "Use superuser account" option. In this case the database and the user will be created for you. Put in the password of your MySQL root user.

All the rest leave unchanged.

Now hit the install Button and you should get a lovely success message.

Now go to wiki/config directory and copy the LocalSettings.php file into the wiki directoy. If you use mediaWiki in the internet you should delete the config directory now.

Now slap in http://MYSERVER/wiki/index.php and you should get a warm welcome on your newly created media wiki.


Email Support for mediawiki on Windows IIS

Remember I recommended to install the PEAR Extra during PHP Setup? (If you forgot, you can simply rerun the installer and modify the installation)

Go to your PHP programm directory and run the pear.bat.

This will ask you a bunch of questions. I simply confirmed each recommendation by return.

After the installation you find a PEAR_ENV.reg . Double click it to add the configuration to the registry.

Create an Includes Directory in your PHP programm directory.

Modify php.ini

Under Start - Programms - PHP 5 you find php.ini

After installing PEAR your should have something like this. Edit the following parameter:

include_path=".;D:\Program Files\PHP\pear"


include_path = ".;D:/INSTALLATIONPATH/PHP/includes;D:\Program Files\PHP\pear"

Remember to adapt the path to reflect the correct path to your PHP directory.

On Windows make sure you do use ; and not : as seperator!

I had some strage issues, where the change of my include path was not reflected in the running php scripts. To avoid unnecessary stress it is advisable to reboot the server now.

Now Download Pear Mail Package (I used 1.2.0b1)

Extract the folders to your newly created include folder.

Now Create a folder "Net" in your "includes" folder

Download Pear Net SMTP Package (I used 1.3.1)
Download Pear Net Socket Package (I used 1.0.9)

Extract the folders to your newly created includes/Net folder.

your INSTALLATIONPATH/PHP/includes folders should now look like this:


and some other subdirectories.

Now go to your wiki directory and edit the file LocalSettings.php

Configure the Mail-Server by adding the following to your LocalSettings.php

$wgSMTP = array (
"host" => '',
"IDHost" => '',
"port" => "25",
"auth" => false

if you need authentication use

$wgSMTP = array(
'host' => "",
'IDHost' => "",
'port' => 25,
'auth' => true,
'username' => "my_user_name",
'password' => "my_password"

To Enable User Emails

find the lines:

$wgEnableEmail = false;
$wgEnableUserEmail = false;

and set to

$wgEnableEmail = true;
$wgEnableUserEmail = true;

To Enable WatchList Notification


$wgEnotifWatchlist = false; # UPO

and set to

$wgEnotifWatchlist = true; # UPO

Remember you have to enable Email Notification for your Watchlist in your user profile as well.


Have fun with a fully operational wiki on Windows and IIS.


If you are looking for WYSIWYG Editor have a look at fckeditor. A bit tricky to set up, but awesome. I am using version 2.6.2.

For source code syntax highlighting have a look at the Geshi extension


Anonymous said...

Thanks! This worked perfectly for me.. I didn't do the email part though (not needed for our purposes)

Anonymous said...

Brilliant! Worked perfectly