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 LAMP(Linux+Apache+MySQL+PHP) environment. It is recommended to simulate the same environment as much as possible under Windows if you want it to run smoothly under Windows. Therefore, IIS is not suggested. A combination of Windows+Apache+MySQL+PHP is highly recommended.

However, it is extremely difficult for newbies to install and configure Apache+MySQL+PHP under Windows individually. I strongly suggest you to download and install EasyPhp. It combines Apache+MySQL+PHP+MysqlAdmin in a single double-click installation,which saves you 99% efforts. And the web-based mysql admin tool is very friendly for newbies. (There are also other comparable installkits available, e.g. http://www.xampp.org/, ...)

Here is the step by step instructions for installing MediaWiki under Windows using EasyPhp. It is a 15 minutes process compared to my original 5-8 hours failed process using the separated installation method. I did the installation under Windows XP Professional. It should work for Windows 2000 or alike.


 * 1) Stop or uninstall IIS from Windows if your machine already has IIS installed. Check control panel->Performance and Maintenance->Administrative Tools-> Is there an IIS icon? If no, that is ok. If yes, stop the web service.
 * 2) Download EasyPhp here.
 * 3) Double click the downloaded EasyPhp installation package under Windows to install it.
 * 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 mini task
 * 6) Change interface language to English by double clicking the "E" icon after installation. There is a select box on the lower part of the popup window.


 * 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 it easy enough? Now let us install wikipedia

(Question from a newbie - How do I do that? Explain more clearly.) Oh yeah. I usually install winrar for each windows machine I use. winrar can uncompress any file formats as I know. :-) google it for download place. Extractnow should also be able to handle this, and it's free. (I can't get the code generation working with 1.3.5. Exactly the same settings works with 1.2.6)
 * 1) Download MediaWiki
 * 2) Uncompress MediaWiki source tree under C:\EasyPHP\www\mediawiki
 * 1) Double check the PHP source files are actually in C:\EasyPHP\www\mediawiki, not in a subdirectory under it
 * 2) Make sure Apache and Mysql are on by double clicking EasyPhp's "E" icon
 * 3) Access http://localhost/mediawiki, configure mediawiki as instructed by the page.
 * 1) Move generated C:\EasyPHP\www\mediawiki\config\LocalSettings.php  to C:\EasyPHP\www\mediawiki
 * 2) Enjoy your MediaWiki under Windows now: http://localhost/mediawiki

Tasks after installation:
 * Go to http://localhost/mysql/ to set root password for mysql, the last / matters!
 * Edit the file C:\EasyPHP\www\mediawiki\LocalSettings.php to configure your wiki.

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). 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
Ändern 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 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.

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 >