Setting Up MediaWiki On A Windows Machine… Part 1

Have you ever encountered this; You’ve spent some time analysing a problem or investigating an issue and want the process you took or the results of the analysis available in a searchable form at a later date. You might have initially saved the input/output of your work in a series of text files which have grown over time making it more difficult to find a specific piece of information and/or increased the workload for backing up your data? Perhaps its time you installed a Wiki.

What is a Wiki?

A Wiki is a series of web pages set up as a communal space for sharing information. Content can be added/deleted/modified by users through their web browser, and the wiki can be backed up to a source control repository as needed.

As a programmer, one of my primary tools is a workspace which allows me to log my work in a diary, store the output of various prototyping experiments and process ideas in a form which supports fast information capture without breaking my workflow. On my local machine I have Wiki running on which I’ve arranged my thoughts and coding snippets so a future me can sift through them when needed. This may not be a perfect solution for you if your Wiki is run from an external server which has frequent downtime or is particularly slow in saving/reading files, in this case using a local store of text files would seem a better choice. You can always upload them to a Wiki later.

After some experience with Confluence and TWiki, MediaWiki was used as:

  1. It is free…
  2. It seems to support all of the formats and functionality needed, if not out of the box, the functionality could be exposed with a small amount of tweaking. For example mathematical functions using LaTex markup can be supported using texvc.

What Do I Need To Try This Out

  1. MediaWiki. I’m using 1.15.1, however you can try the latest version from here;
  2. PHP. I’m using the thread-safe 5.2.12 version. Make sure that you don’t use 5.3.1 as its borked for MediaWiki at present. You can find various versions here;
  3. A database server. MediaWiki actually supports SQLite however for this install I used MySql 5.1.43. Have a look here for the full fat 109MB install.
  4. A webserver. I’ve used Abyss again for this installation. For more information have a look at a previous blog post here.

MediaWiki installation has been separated into two posts:

  1. Part 1 covers getting your initial workspace up and running.
  2. Part 2, to be written in a future post, covers extensions, LaTex support and creating mathematical functions for MediaWiki.

How To… Install

  • DL and install MySQL. This step is relatively simple, make sure you run the full installation. After installation a dialog should appear which will allow you to set up a database to be used by MediaWiki. Use the following settings
    • Developer machine.
    • Multifunctional database.
    • Tablespace settings to c: installation path.
    • DSS/OLAP 20 users.
    • For the moment turn off TCP/IP connections as its for internal use only.
    • Enable strict mode.
    • Standard characters set.
    • Install as windows service.
    • Add to PATH variable.
    • Create a root password, no remote root access.
  • Install PHP. If this is a first installation, 5.2.12 doesn’t appear to have an installer, so simply unzip to a new directory, for example “c:\program files\php” and add the directory to the %PATH% variable.
  • Install Abyss. You will need to create a web directory, for how to do this, see a previous post here.
  • In Abyss go to Configure > Scripting Parameters. Add an interpreter for FastCGI (local pipes) and set the file to php-cgi.exe in the PHP installation directory (“c:\program files\php”). Set the associated extension to php and restart the Abyss server.
  • Unzip the the MediaWiki installation to your web directory. As a test the installation sits in its own directory “c:\httpdocs\wiki” and is accessible at https://localhost/wiki. Once unzipped you can start the wiki configuration process by browsing to https://localhost/wiki/Config/index.php. You may get something like this appear in your browser:

>PHP 5.2.12 installed
>Could not find a suitable database driver!
>For MySQL, compile PHP using –with-mysql, or install the module

  • If you can see the output above, there may be a problem with your php setup! Have a look in the php.ini-recommended file in your PHP installation, copy this to php.ini, it will form the basis of your php setup.
  • Either add or uncomment the following lines in your php.ini, otherwise MySQL will not be supported with PHP. The session save path shown below is for WindowsXP, for Windows7 you will need to use the c:\users directory instead.
    • extension=php_mysql.dll
    • extension_dir = “C:\Program Files\PHP\ext”
    • session.save_path = “C:\DOCUME~1\USERNA~1\LOCALS~1\Temp\php”
  • Restart Abyss.
  • Browse back to the MediaWiki configuration page at https://localhost/wiki/Config/index.php to begin configuration. The configuration tool will generate a PHP file called LocalSettings.php under a Config directory in your Wiki installation, copy this into your Wiki root directory and delete the Config directory. Here are some template settings:
    • Wiki name: FuncRandmWiki
    • Contact e-mail: root@localhost
    • Copyright license: No license metadata
    • DB config is mysql, make sure that you use the root db password unless you want one of your db passwords appearing in plaintext in the LocalSettings.php file that MediaWiki generates.
    • Use InnoDB
    • mySQL 4.1/5.0 binary db character set.
    • I added funcwiki_ as a prefix for the db tables, you might want to add a different prefix.
  • Test the Wiki by opening https://localhost/wiki/index.php in your favourite browser. Upon running this for the first time the munged URL https://localhost/wiki/Config/index.php/index.php?title=Main_Page appeared as the URL address, and the following page appeared in the browser:

Error 404

Not Found

Powered by Abyss Web Server X1
Copyright © Aprelium – 2001-2009

  • It appears that there is a problem with the LocalSettings.php file, in which there is an environment variable, $wgScriptPath which in my case pointed to “/wiki/Config/index.php”. This is broken as the Config directory is temporary and should be deleted. Change this entry to:

$wgScriptPath = “/wiki”;

  • Test the Wiki by opening https://localhost/wiki/index.php in your favourite browser. You should be able to create an entry, here is one that I made earlier…


Part 2 which will look at:

  • MediaWiki Extensions
  • LaTex support.
  • Mathematical notation for MediaWiki.

2 thoughts on “Setting Up MediaWiki On A Windows Machine… Part 1”

Comments are closed.