3 November 2004

Configuring MediaWiki on IIS

This entry is a repository of links and instructions covering how to install MediaWiki on a Windows 2000 IIS machine (ongoing).

[ 26 Apr 2006 ] Added the section "How to add categories to redirects"
[ 25 May 2006 ] Added the section "How to link to category pages"
[ 25 Aug 2006 ] Added the section ""
  • MediaWiki [Wikipedia]
  • MediaWiki is the wiki used by Wikipedia.

  • MediaWiki Handbook and installation instructions
  • You will need MySQL, a Web server (I'm using IIS), PHP for Windows (excellent information in the comments), and MediaWiki itself.

    I used the Windows binaries for the PHP 5.0.2 zip package. The PHP 5.0.2 installer did not install the MySQL extension for PHP.

    "Installing PHP on a Windows System" is from 2000 but has some tips on setting up the PHP ISAPI filter and running a quick test. "How to install and configure PHP5 with IIS6 on Windows Server 2003 in five easy steps" has more detailed information along with personal observations and quirks (always helpful). "Setting up PHP to work on Windows Server 2003" pointed out that IIS uses php-cgi.exe instead of php.exe.

    Running MediaWiki on Windows has instructions on installing MediaWiki. Once installed, I tried to run it from a subdirectory from an existing Web site. Because of the absolute file references within the PHP code, I needed to give it its own Web site.

  • Documentation/usage
  • For as much as I love the concept and application of wikis, the documentation for MediaWiki is somewhat scattered. The best place to start looking (if you're not just performing a standard search) is at the English documentation category page. That links to (I think) every relevant page.

  • Creating a New Page
  • This is a little un-intuitive. You have to first create a link to the page, then click on the link to edit the page. If the page doesn't exist, you will automatically be brought to the edit screen for that page. The editing section describes this process.

  • Creating a template
  • Help:Template from the MediaWiki reference

    1. Create a new page named Template:MyTemplate
    2. Enter your template text
    3. Replace dynamic text with placeholders for parameters: {{{paramName}}}
    4. Save

    The template can be used as follows:

    {{MyTemplate|paramName1=This text will be used to replace the parameter placeholder|paramName2=As will this text}}
  • MediaWiki Markup
  • Because many people can't type HTML quickly or intuitively, wiki text is formatted using special markup codes that are more terse than HTML. An explanation of the markup, with examples, is available here.

  • How to add categories to redirects
  • I have been adding entries that are appropriate under multiple titles. Redirects are perfect for this, but I would like both titles to show up under their category pages. This is a very specific requirement, and somewhat inefficient, but it works for my needs.

    To accomplish this, you need to place the category markup on the same line as the #REDIRECT markup. It cannot be above or below or it will be ignored (although I have seen it work sporadically).

    #REDIRECT [[My article]] [[Category:Stuff]] [[Category:Stuff2]]
  • How to link to category pages
  • Prefix the Category wikilink with a colon:

    [[:Category:Stuff|My stuff category]]

    I found this trick in the Links section of the Help:Editing page.

  • Controlling User Access
  • This is described in the section Setting user rights in MediaWiki. The default settings allow anyone to view and edit the Wiki. I changed this to allow only registered users to view the Wiki, and to allow only sysops to create users and edit the Wiki. I added three lines similar to those recommended in Configuring access restrictions to your wiki, except that I set read access to "Special:Userlogin" and new account creation to sysop.

    The section title Help:Logging in has subsections intended to describe restricting viewing and editing. They were empty, so I edited them to point to the user rights section listed above.

  • Eliminate Script Errors
  • The PHP scripts had two errors in my IIS installation. The first was:

    Undefined index: REQUEST_URI in E:\Web\Default\Wiki\mediawiki\includes\Setup.php on line 92

    I resolved this by simply commenting out the line. The second was similar:

    Undefined index: REQUEST_URI in E:\Web\Default\Wiki\mediawiki\includes\Skin.php on line 568

    I resolved this one by changing the indexed value referenced from the $_SERVER array:

    # $baseurl = $_SERVER['REQUEST_URI'];
    $baseurl = $_SERVER['REMOTE_ADDR'];

    I'm not immediately sure how the values differ, but this eliminated the error with (so far) no side effects.

    This Wikimedia page confirms the script problem above but provides a slightly different solution (I still haven't gotten familiar with the code, so their solution is probably more informed). They also have additional tips on configuration and installation for IIS. Good stuff.
[ posted by sstrader on 3 November 2004 at 1:43:41 PM in Home Network & Gadgets ]
Comments

Thanks for the comments! I was having a problem with my Wiki pages turning up blank and this seems to have fixed it.

Posted by: Kal at July 22, 2005 8:14 PM
Post a comment












Remember personal info?