Manual:Running MediaWiki on Windows

&lt; Running MediaWiki

This page will give you information about installing MediaWiki on a Microsoft Windows system.

You will need the following software: You will also need some serious hardware for the full Wikipedia database.
 * Support software
 * DBMS: MySQL only option currently supported
 * Web Server: Apache or IIS
 * PHP
 * other utilities such as texvc
 * the Mediawiki code itself

The fastest and easiest install method
NOTE: MediaWiki is developed under a LAMP (Linux+Apache+MySQL+PHP) environment. It is recommended that you use as much of this stack as possible under Windows if you want MediaWiki to run smoothly. Therefore, IIS is not recommended. Instead, using the "AMP" portion of the "LAMP" stack is more likely to succeed.

It is extremely difficult for beginning users to install and configure Apache+MySQL+PHP under Windows one product at a time. I strongly suggest you download and install EasyPhp. It combines Apache+MySQL+PHP+MysqlAdmin into one single installation, which saves you 99% of the trouble of configuring each package manually. Incidentally, the web-based MySQL admin tool is very friendly for newbies. (There are also other comparable installation kits available, e.g. http://www.xampp.org/, ...) See also: Wiki on a stick.

Here are the step by step instructions for installing MediaWiki under Windows using EasyPhp. It is a 15 minutes process instead of my original 5 to 8 hour unsuccessful attempt using the separated installation method. I did the installation under Windows XP Professional, though it should work for Windows 2000 or similar releases.

Preparing Apache, MySQL and PHP

 * 1) Stop or uninstall IIS from the Windows management tools if your machine already has IIS installed. Check "Control Panel->Performance and Maintenance->Administrative Tools->..." Is there an IIS icon? If not, you're done. If there is, stop the IIS service.
 * 2) Download EasyPHP here.
 * 3) Double click the downloaded EasyPHP installation package under Windows to install it. Some of the screens of the install wizard may not be in English.
 * 4) Be sure to change the default installation path to C:\EasyPHP instead of C:\Program Files to avoid the space in path.
 * 5) Run EasyPHP from "Start->All Programs->EasyPHp1-7->EasyPHP".  A bold black "E" will appear as a mini task when EasyPHP is running.
 * 6) Change the interface language to English by double clicking the "E" icon after installation is complete. There is a select box on the lower part of the popup window where you can specify the language to use.


 * 1) Start Apache and MySQL from the same popup window
 * 2) Go to http://localhost/ to test it

The Apache+MySQL+PHP+MysqlAdmin is all set! Isn't that easy?

Installing wikipedia
After successfully installing the underlying software, you can install wikipedia.

(I can't get the code generation working with 1.3.5. Exactly the same settings works with 1.2.6)
 * 1) Download MediaWiki from sourceforge file list or portal page
 * 2) Uncompress the MediaWiki source tree under C:\EasyPHP\www\mediawiki . I usually install WinRAR for each Windows machine I use. WinRAR can uncompress all common compressed file formats. Google on WinRAR for download sites. The Extractnow utility should also be able to handle this, and it's completely free (WinRAR requests a donation). (Actually Extractnow doesn't handle tarballs - try Stuffit.)
 * 3) Double check that the PHP source files are actually in C:\EasyPHP\www\mediawiki, not in a subdirectory underneath it.
 * 4) Make sure Apache and Mysql are on by double clicking EasyPhp's "E" icon.
 * 5) Access http://localhost/mediawiki and configure mediawiki as instructed by the page.
 * 1) Move generated C:\EasyPHP\www\mediawiki\config\LocalSettings.php to C:\EasyPHP\www\mediawiki\ .  I.e. move it into its parent directory
 * 2) Enjoy your MediaWiki under Windows now: http://localhost/mediawiki

Tasks after installation:
 * Go to http://localhost/mysql/ to set root password for MySQL. Note that entering the trailing "/" matters!
 * Edit the file C:\EasyPHP\www\mediawiki\LocalSettings.php to configure your wiki.

Installation for 1.3.7 on Windows.
 * Copy /includes/DefaultSettings.php and rename it as LocalSettings.php
 * Add $IP="C:\\{Actual Pathname of MediaWiki}" e.g $IP = "C:\\Program Files\\Apache Group\\Apache2\\htdocs\\mediawiki"
 * Change stylepath to $wgStylePath  = "$wgScriptPath/stylesheets";
 * Remove all curly brackets
 * Change the database name-$wgDBname
 * Change logo path to $wgLogo= "$wgScriptPath/stylesheets/images/wiki.png";

Support software
You can install the three support components individually, or all together as a package. A good example of the latter is Xampp (frequently updated as of September 2004) and Uniform Server. Other options, which as of September 2004 have not been updated since 2003, include IBServer, EasyPHP and FoxServ.

Database Management System
''The only DBMS currently supported is MySQL. Further instructions will be added as other options become available.''

The download link below points to a page with all available versions of MySQL. The one you want is "Production release" which is recommended.

While downloading, read the Install Guide using the second link below.
 * Download
 * Install Guide

Download and install
Install the Apache web server from http://www.apache.org/ using the latest 2.x binaries. Use the Download link below, select a mirror close to your location and download the "Win32 Binary (MSI Installer)" version. Currently this is version 2.0.50 (sep. 2004)
 * Download
 * Install Guide

Configure
Change the httpd.conf file for apache. It should be located at "C:\Program Files\Apache Group\Apache2\conf" if you used the default installation: LoadModule php4_module {PATH TO YOUR PHP FOLDER}/sapi/php4apache2.dll AddType application/x-httpd-php .php AddType application/x-httpd-php .php .php4 .phtml AddType application/x-httpd-php-source .phps php_admin_flag engine off  php_admin_flag engine on    
 * Add these lines at the end of the block of LoadModule lines:
 * Change the DocumentRoot
 * Add the PHP types and disable PHP for all directories other than the wiki


 * Note: if you need PHP for other purposes, you will need to add other directory sections like that above. Do not enable the PHP engine by default.
 * It is not strictly necessary to enable the rewrite engine or include the ampersand patch
 * You will have to change c:/playpen/wiki/runtime/wiki to your script directory. Copy all the executable PHP files for MediaWiki into this directory.

PHP
Install PHP from http://www.php.net/ using the latest windows binaries using the Zip package. Latest version 4.3.8.
 * Download
 * Install Guide
 * Documentation in several langages

I found that you needed to copy php4ts.dll to the windows/system32 directory in order for Apache to load php4apache2.dll Imran 08:59, 27 Apr 2004 (UTC)
 * There is also the option of copying php4ts.dll to the directory which contains php4apache2.dll - Jeronim 14:32, 21 Jul 2004 (UTC)

You will need to enable the GD library to use the thumbnailling pictures. Note that if using ImageMagick, the path contained in wgImageMagickConvertCommand cannot have spaces.

Texvc
texvc</tt> is the external program MediaWiki uses to render math expressions into nice looking PNG. Getting it up and running on Windows can be somewhat troublesome, as it was developed on and for linux, so here is a quick and dirty hack to make it work under Windows.

What you'll need:
 * the texvc</tt> sources (included in the math directory of the MediaWiki distribution)
 * a Make utility (for example mingw32-make, included in MinGW)
 * an OCaml compiler
 * Latex and dvips (for example using the Miktex package for Windows)
 * ImageMagick binaries for windows

First modify render.ml</tt> to reflect specificities of the windows platform: let cmd_dvips tmpprefix = "dvips -R -E " ^ tmpprefix ^ ".dvi -f" let cmd_latex tmpprefix = "latex " ^ tmpprefix ^ ".tex >/dev/null" let cmd_convert finalpath = "convert -quality 100 -density 120 ps:- " ^ finalpath ^ " >/dev/null 2>/dev/null" becomes: let cmd_dvips tmpprefix = "dvips -R -E -q \"" ^ tmpprefix ^ ".dvi\" -f >\"" ^tmpprefix^".ps\" " let cmd_latex tmpprefix = "latex -quiet \"" ^ tmpprefix ^ ".tex\" >\""^tmpprefix^".tmp\" " let cmd_convert finalpath tmpprefix = "convert -quality 100 -density 120 \"ps:"^tmpprefix^".ps\" \"" ^ finalpath ^ "\" " because Windows doesn't handle /dev/null nor pipes very gracefully, and as the quiet option doesn't work on latex for Windows.

As this creates more temporary files, you have to delete them too: Sys.remove (tmpprefix ^ ".dvi"); Sys.remove (tmpprefix ^ ".aux"); Sys.remove (tmpprefix ^ ".log"); Sys.remove (tmpprefix ^ ".tex") becomes: Sys.remove (tmpprefix ^ ".dvi"); Sys.remove (tmpprefix ^ ".aux"); Sys.remove (tmpprefix ^ ".log"); Sys.remove (tmpprefix ^ ".tex"); Sys.remove (tmpprefix ^ ".ps"); Sys.remove (tmpprefix ^ ".tmp")

And finally, split the call to dvips</tt> and convert</tt> in two: else if (Sys.command ((cmd_dvips tmpprefix) ^ " | " ^ (cmd_convert (finalpath^"/"^md5^".png"))) != 0) then (unlink_all ; raise (ExternalCommandFailure ("dvips"))) becomes: else if ( (Sys.command (cmd_dvips tmpprefix)!=0  )) then (unlink_all ; raise (ExternalCommandFailure ("dvips"))) else if (Sys.command (cmd_convert (finalpath^"/"^md5^".png") tmpprefix)!=0) then (unlink_all ; raise (ExternalCommandFailure ("dvips")))

If you have Visual C++ and MASM installed, make the optimized texvc.exe</tt> by running the make utility in the math directory. If you do not have Visual C++ and MASM, make the bytecode version texvc.bc</tt> (by typing for example mingw32-make texvc.bc</tt> in the math directory) and rename it to texvc.exe</tt>. Copy the executable into your base MediaWiki directory.

In /includes/Math.php</tt> replace the following: wfDebug( "TeX: $cmd" ); by the following: $cmd=str_replace("'","\"",$cmd); wfDebug( "TeX: $cmd" ); because in Windows single quotes do not work as quote markers in command line. And comment the following: if( !is_executable( $wgTexvc ) ) { 				return $this->_error( "math_notexvc" ); 			} becomes /*if( !is_executable( $wgTexvc ) ) { 				return $this->_error( "math_notexvc" ); 			}*/ because windows can't find the is_executable function.

In LocalSettings.php</tt>, uncomment or insert: $wgUseTeX= true; to activate texvc functionality.

If you are using MediaWiki with IIS then you should replace "REQUEST_URI" with "SCRIPT_NAME" in all files.

And finally, set the texvc</tt> executable path to the root path of Wiki, by inserting this line in LocalSettings.php</tt>: $wgTexvc = "texvc"; # Location of the texvc binary

Let me know how this works for you in the discussion page.

MediaWiki
There are two options
 * the last stable release of the mediawiki software
 * the latest development version.

Stable release

 * go to http://sourceforge.net/projects/wikipedia/
 * press Download on the left of "MediaWiki stable release"
 * Save on your disk and extract it to c:\easyphp\www\mediawiki\

Latest release
This is the development version of MediaWiki and include the last changes made by the developers. If you aren't familiar with computering fall back to stable release.

If you do not already have a CVS client, you will have to get one and install it. WinCvs is a correct CVS software under windows http://www.wincvs.org/

Get MediaWiki from the CVS archives.

Installing
Visit your wiki with a web browser and follow the install directions! :) (Go to /config/index.php from the directory where you installed MediaWiki)

not sure how well the following applies

PHP does not handle the include_once directive properly on all windows platforms and filesystems, probably due to the Windows treatment of upper and lower case in file names. You may have to comment out the include_onces in some of the .php files in the folder "includes" as follows:

Article.php:	# include_once( "CacheManager.php" ); Setup.php:	# include_once( "$IP/Title.php" ); SpecialMovepage.php:	#include_once( "LinksUpdate.php" );

Alternatively ensure that all inclusions use the same format i.e. make occurrences of ("CacheManager.php") and ( "$IP/CacheManager.php")'' consistent by using only one or other format. (I think the problem is because using the different formats is interpreted as two separate includes Mintguy 03:41, 22 Nov 2003 (UTC)).

When running IIS, if image uploading does not work, open SpecialUpload.php in the "includes" directory and change the text "if ( ! move_uploaded_file( $wpUploadTempName, $wgSavedFile ) ) {" to "if ( ! copy( $wpUploadTempName, $wgSavedFile ) ) {" This may be a PHP bug, but it got image uploads to work. Harbenger 08:09, 3 May 2004 (GMT-4).

iconv
Also, you really do need iconv for some of the special pages to work, unless you comment out the relevant call in language.php:

# return iconv( "UTF-8", $wgInputEncoding, $s );


 * Q:Did you try the iconv hack?
 * A:I believe there's a win32 build of iconv available out there somewhere!
 * Try looking at http://in2.php.net/iconv for more info! and a Win32 working (??) version is available at http://www.zlatkovic.com/pub/libxml/iconv-1.9.1.win32.zip

Content
All the articles of Wikipedia and their revisions are available for download at http://download.wikipedia.org/ in a MySQL dump format. The cur dump is enough for reading / mirroring wikipedia. \progra~1\mysql\bin\mysql -u root -p mysql> use wikidb Database changed mysql> mysql> source c:\temp\20031104_cur_table.sql
 * the cur dump only holds the latest modification of an article
 * the old dump has all the earlier revisions
 * Save and extract the file somewhere (ex c:\temp\).
 * Open a command box (start -> run -> cmd.exe).
 * Execute:
 * Enter root password for mysql
 * At the prompt select the wikipedia database (this is, by default, named 'wikidb'):
 * Then load the dump (change filename by the filename you downloaded):

N.B. this will take some time (several hours) if you load the full dump of the English Wikipedia database!

Next page: Running MediaWiki on Mac OS X >