Manual:Running MediaWiki on Windows

&lt;- MediaWiki User's Guide &lt; Running MediaWiki

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

You will need the following software:
 * Support software
 * DBMS: MySQL only option currently supported
 * Web Server: Apache or IIS
 * PHP
 * other utilities such as texvc
 * the Mediawiki code itself

You will also need some serious hardware for the full Wikipedia database.

Support software
You can install the three support components individually, or all together as a package. Examples of the latter are IBServer, EasyPHP or 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.48 (nov. 2003)
 * Download
 * Install Guide

Configure
Modify the httpd.conf file for apache. It should be located at "C:\Program Files\Apache\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.4.
 * 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.

Texvc
texvc 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 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 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 and convert 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 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.

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:\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 >