Manual:Newcomers guide to installing on Windows


 * See also: Manual:Simple Windows Apache Installation, Manual:Streamlined Windows Install Guide

Installing Mediawiki on Linux and Unix is relatively straightforward. Installing on Windows is more complex.
 * Some packages are not ideally suited for Windows, or specific compilations are needed
 * Instructions for some modules are not clear
 * Appropriate versions are not always clear
 * Some error messages are harder to trace in Windows than in Unix or Linux.

The following is a summary of windows installation, including some of the key config files and details.

Caveat
Despite its innocent title, this page is not suitable for mere users. It's more like a system administrators first guide to installing on Windows. It's beyond most casual Windows user's depth. It takes huge liberties in assuming knowledge of Apache, PHP, MySQL, and Windows internals. Much of the information appears to be outdated, relating to older versions of some of the basic 3 packages.

Heck, schmeck... I've got 20 years experience, and I'm finding myself lost. Make sure you understand it all before getting started.

Hope you'll find a streamlined Windows Install Guide for installing wikiMedia 1.6.5 on Windows XP, SP2, with Apache 2.2.2 and PHP 5.1.3 helpful. It's straightforward, no special twists, no deviation from the defaults, just so that the whole thing works.

A very simple installation for Mediawiki on your PC (using XAMPP)

 * Download and install XAMPP : http://www.apachefriends.org (download-link)
 * Start Apache (the webserver) and MySQL (the database) from the XAMPP Control Panel application
 * Launch your web browser and go to  http://localhost  (this automatically takes you to  http://localhost/xampp/ )
 * Click the Security link
 * To set the security, click the  http://localhost/security/xamppsecurity.php  link
 * choose a MYSQL password and a XAMPP username & password (when prompted for a "xampp user" username & password, just supply the username & password that you've just chosen)
 * Click the phpMyAdmin link. Supply the MYSQL password (that you prev. entered).
 * Create a new Database, called e.g. wikidb
 * Download Mediawiki : http://www.mediawiki.org/wiki/Download
 * It needs to be decompressed twice. In Windows, if you don't have a decompressor for extensions gz and tar, download 7-zip : http://www.7-zip.org/
 * Place the Mediawiki-X.X folder inside C:\Program Files\xampp\htdocs (X.X is the revision # of MediaWiki.) (There are already other folders in there, like xampp)
 * Rename the Mediawiki-X.X folder to wiki (or other name of your choice)
 * Go to  http://localhost/wiki . You should see a smiling wiki.
 * Continue and locate further help, if necessary.
 * Finished

Software used for a standard installation

 * Windows 2000 or XP or 2003
 * Apache v2.x (Tested with 2.0.52)
 * MySQL v4.0.x (Tested with 4.0.21)
 * PHP v5 (Tested with 5.0.1, could not run it on Windows Server 2003 - used 4.3.8 instead)
 * phpMyAdmin, used to monitor and manage MySQL (Tested with 2.6.0-pl3)
 * Webalizer, used to monitor apache page serving and wiki demand on the server.
 * Zend Optimizer, used to make the Wiki code run more efficiently (v2.5.7, free from Zend)
 * Memcache (compiled for PHP 5.0.1, Windows) (but you can also use Turck MMCache)
 * ImageMagick (Tested with v5.5.7, support for v6+ is "still experimental")


 * Mediawiki (Tested with 1.4 beta 3)

All in one, or separates
I tried to use all-in-one's, like EasyPHP and Xampp. To be honest, I wasn't happy with either. There were a few reasons. EasyPHP has some out of date stuff (I want to use PHP5 on other pages), and xampp is fine if you dont want to customise it. But as each individual program is updated, it's normal to want to run the latest stable versions, and an all-in-one ties you down a lot. So these instructions summarise installing "separates". Its harder, and slower, but more fulfilling and future-proof when done. Plus you don't have to wonder if you are running half the package or what has been left out, or tweaked.

If you want to use an "all-in-one", presently the only one I feel comfortable with (December 2004) is The Saint WAMP [TSW], which appears comprehensive, well documented, up to date and comes very well configured "out of the box".

Note: DeveloperSide.NET Apache Web-Server Suite is one of the few distributions that focus on stability, security, and ease of use without throwing in every useless software add-on possible. An extremely standard WAMP package.
 * Note on note: The package, weighting a hefty 33MB, _does_ include every useless software add-on possible. Or, at least, it includes more than is needed for a MediaWiki install. No easy unistall, or configuring also leads me to believe that this "helpfull" addition is little more than a shameless plug. This isn't a package suited for beginners. You're better off installing each individual element on your own.
 * Note on response note: Apache, PHP, MySQL, Perl, the components listed in "Software used for a standard installation"... Those are useless packages and addons? It has two install options: manual step-by-step and automatic -- where all you do is select a drive letter. Uninstall? Delete the install directory, remove apps from path, done. Everything is described in the docs. Just trying to offer a choice here. The other package here, The Saint, is a bigger download than 33MB and does truly contain addons.

MySQL
I have memories of warnings about MySQL 4.1 as opposed to 4.0, but these may be out of date or minor. Someone will need to advise if these are important or not. They may not be.

Problems may be had in using PHP 4 with MySQL 4.1 due to the new MySQL authentication methods.

Memcache
Memcache can speed up PHP by several hundred times, as it caches the results of compiled PHP code for future use. It's well worth using and mediawiki will advise if it's up and running.

You can download it for Windows from the PECL archives at. Note that you must be running the same PHP version as the libraries you install. Simply extract the php_memcache.dll into your extensions directory and add an extension=php_memcache.dll line to your PHP.ini.

ImageMagick
This allows Mediawiki to perform magic with images.

Note: ImageMagick 6.2.3 has an installer for Windows.

For a complete and easy set of instructions using the windows installer, see the FAQ entry for ImageMagick on Windows
 * Tested with ImageMagick-6.2.5-0-Q16-windows-dll.exe - Take ALL the defaults on the installer.
 * Make all changes specified for LocalSetting.php
 * No changes are necessary in php.ini
 * Don't worry about spaces in directory path, you just point to "convert", the installer takes care of the windows path
 * Don't worry about php_imagick.dll, it's not necessary when using the installer
 * Tested with the 1.4.10 version of MediaWiki

If the above doesn't work for you, or you can't use the ImageMagick windows installer, the following may provide other ideas to try: After running the installer, all you need to do is update the relevant settings in LocalSettings.php, as follows:
 * If you have properly installed PHP, you do not need PerlMagick for ActiveState Perl in order to use ImageMagick with MediaWiki (as the install instructions advise).
 * Make sure that the "Update executable search path" option is selected when you get to the "Select Additional Tasks" page of the wizard.
 * Apparently, MediaWiki will not be able to find ImageMagick if you install into a directory path that includes spaces.

$wgUseImageMagick		= true; $wgImageMagickConvertCommand = "C:/ImageMagick/convert";

Substitute the path to your own installation of ImageMagick in the. (Remember to use forward slashes, and don't install into a path with spaces. The installer defaults to C:\Program Files\ImageMagick..., so you will need to change that).

The following instructions apply if you are not using the Windows installer:

I have had some problems in figuring out whats needed, mostly due to lack of information. Things I have found: The official source for this only has experimental support for ImageMagick v6+, so it may be worth sticking with a version 5.x if unsure. There is a page on LocalFoo (part of The Saint WAMP [TSW]) which describes how to install ImageMagick. It's so far as i can see, the only good description on the net of this process.
 * There are different issues with versions < 6.0 and versions 6+
 * You need, in addition to ImageMagick, a php extension to access its dll, usually called php_imagick.dll. There are versions around of this.

In overview, one needs a folder with all the image processing DLLs in (from ImageMagick), the link to these must be added to PATH, and then php_imagick.dll is added as a PHP extension to allow PHP to use these internally within mediawiki. (I think!)

The above page gives more details.


 * Note, you must click the box in the ImageMagick installer that says "Install ImageMagickObject OLE Control for VBsc ript, Visual Basic and WSH".  I had no end of hassle until I did this.  I'm using EasyPHP on Win2k.

MediaWiki
There is apparently a bug in the current version's setup module. What should happen the first time you run mediawiki, is it should ask you to set up the wiki, then accept some basic info, set it up, create a LocalSettings.php file, and report success.

Version 1.39 didn't create the file, and reported a blank page. After asking round I tried a beta version of 1.4, which worked correctly.

Note that mediawiki assumes your MySQL admin account is called "root". If it isn't, you will need to temporarily ensure it is, to set up the wiki. (in MediaWiki 1.5.8, you can configure the admin name to your own choice).

Installation1
We set Apache, MySQL and PHP up first, then add other features.

Apache2

Straightforward. If you dont know your server or domain, just enter MY_SERVER and MY_DOMAIN, you can edit those in http.conf later. Install it as a service. Done.

Or ... does anyone have a link to step-by-step instructions with troubleshooting and confirmation checks?

MySQL

Also straightforward.

Or ... does anyone have a link to step-by-step instructions with troubleshooting and confirmation checks?

PHP5

You get two options here, a zipped binary version, or a .exe installer version. Go for the zipped version. Save it in a folder of your choice. You only need selected files out of it.

Or ... does anyone have a link to step-by-step instructions with troubleshooting and confirmation checks?

Special folders
Special folders include:
 * 1) A documents folder for Apache to use as its root, for serving web pages. Create one, if you don't want to use the default.
 * 2) For MySQL, a data folder and a temporary folder. Put them where you like. You must copy the mysql folder from its default location if you change it, or MySQL will not be able to start.
 * 3) For phpMyAdmin and 'Mediawiki':  both of these are PHP scripts. As far as Apache is concerned, they are nothing more than web pages being served. So you will want 2 folders in your web server folder, one called "\phpmyadmin" and one called "\wikiname" (a short name for a wiki, like \wiki2 or \mywiki). Just dump the entire phpmyadmin code into the first, and the entire mediawiki code into the second.
 * 4) For Memcache, create a folder it can use for temporary use.

Note from a reader! The part about phpMyAdmin is unclear. There is no actual folder with that name in the MySql or Php folders - only files with the phrase 'mysqladmin' as part of their name, in the mySql "bin" folder. Could somebody make this clearer for us beginners? -> You must download phpMyAdmin and install it. See the link above for an install guide (Where? A LINK us usually a LINK!)

Peter Blaise says: phpMyAdmin downloads and expands without any installation routine, so once downloaded and expanded to a backup master copy location of your choosing (like C:\Install\phpmyadmin-install\...) then copy the contents in total to C:\yourwebroot\phpmyadmin\*.* and configure it from there using your browser ... by browsing to .../phpmyadmin/index.php - which, on a local machine is probably http://localhost/phpmyadmin/index.php and go from there. See also links like http://www.wikihow.com/Install-phpMyAdmin-on-Your-Windows-PC -- peterblaise 19:10, 16 May 2007 (UTC)

Configuration
Configuration can get complex and messy. So this is in overview. A working copy of config for each of the programs is given below, to show a version which worked.

File and path names
Be aware most of these programs were initially developed for unix and linux. So in most cases you have to enter windows filenames with a / not a \. This is a very common problem. For example, the line to a file might be C:/PHP not C:\PHP in some config files.


 * Apache and MySQL use / instead of \ for paths, under windows.
 * PHP.INI uses \ (see note below)

All of these programs can handle spaces in file names, but be sure to use quotation marks around them when used in configuration files or on the command line. Like this:.


 * ''It is advisable to use forward slashes on Windows at all times, or at least whenever you install a package that is cross-platform developed. Windows itself can easily handle those forward slashes. If, for some reason, a path internally ends up looking like this:  windows will silently correct this.

Files you need to move into correct places
Config files can go in a variety of places. Ultimately I put php.ini and my.ini (MySQL) into the C:\WINDOWS system folder, and left the apache http.conf file where apache put it. You can tweak these using the Phpinidir parameter in apache2, by tweaking the system PATH, or in other ways. But this worked best and easiest for me in the end.


 * A note from a reader: There is no file called my.ini in the latest version of MySql (5.0.25) and in Php the nearest probable files are called php.ini-recommended and php.ini-dist, and you are apparently supposed to rename them php.ini. Novices and even intermediate computer users like myself really need stupidly-clear (!) instructions for these types of procedures, because we really don't understand the software. So if someone knows how to correct this, it would be greatly appreciated!


 * Response to reader: php.ini-recommended and php.ini-dist are two files that do the same thing but with different settings. The makers added the -recommended and the -dist to make sure that the files don't confuse each other, so neither of them work when they have that suffix. The one with -recommended at the end is the one that is recommended (go figure) and the other one is for more advanced users I guess. So just take the suffix off of the one you want, making it php.ini and that should activate the file. Hope that helps.

The files you need to move or copy are:


 * PHP CONFIG - php.ini into C:\WINDOWS. The version to start with is the "recommended" ini, if you look for it in the PHP folder.
 * PHP EXECUTABLES - move the following files into C:\WINDOWS as well: libmysql.dll, php5ts.dll, php.exe, php_mysql.dll(ext). The two MYSQL files are needed for MYSQL functionality, the PHP5TS is the main PHP executable, and the PHP.EXE is for command line PHP to work if you ever need it. Any other PHP_ extensions you plan to use, put in the same folder.
 * MEMCACHE.DLL - put mmcache.dll into C:\WINDOWS too, when you find it. Its just another php extension.
 * MYSQL CONFIG - pick one of the my.ini files and put that in C:\WINDOWS too. There are several of them, the difference is mostly dependent on how powerful the server will be and how much resources you will give MYSQL. They're all mostly the same apart from that.
 * APACHE CONFIG - http.conf, held in Apache2\conf. Leave it there.

NOTE: PHP 5 recommends that you leave the php.ini file and all dlls in the PHP directory tree, and using the PATH environment variable and PHPIniDir directive to integrate with Apache2. If you do so, then the only PHP files you'll need to copy are libmysql.dll and php_mysql.dll into the Apache2 root directory (by default, C:\Program Files\Apache Group\Apache2), rather than C:\WINDOWS. Also, although PHP 5 says that MySQL support is embedded, you will need to uncomment the php_mysql.dll extension in php.ini.

When you edit the config files, remember, most of these programs are extremely fussy about the contents of the config files. Always save a backup before editing, because it's almost guaranteed at some point you will get an error and need to revert to the previous version. If in doubt, take system restore points at key points where you feel you have got somewhere, and don't change so much at once that you forget what you've done.

MySQL setup
When using the Configuration Wizard after installing MySQL from the .msi, make sure to leave the language setting set to default "Latin1". If you choose "utf8", MediaWiki will encounter the following error when attempting its initial setup: Creating categorylinks table...Query "CREATE TABLE categorylinks ( cl_from int(8) unsigned NOT NULL default '0', cl_to  varchar(255) binary NOT NULL default , cl_sortkey varchar(255) binary NOT NULL default , cl_timestamp timestamp NOT NULL, UNIQUE KEY  cl_from(cl_from,cl_to), KEY cl_sortkey(cl_to,cl_sortkey(128)), KEY cl_timestamp (cl_to,cl_timestamp) )" failed with error code "Specified key was too long; max key length is 1024 bytes".

If you have encountered this error and do not want to change the default character set for the MySQL server, remove all tables from the database the MediaWiki installation has created, and set the default character set for the database to Latin1 (MySQL query: "ALTER DATABASE `wikidb` DEFAULT CHARACTER SET latin1 COLLATE latin1_general_ci", optionally using a MySQL administration front-end such as phpMyAdmin), then run the MW installation again. Also see resolved bug 2907.

When working with MySQL Version 4.1 and above you must turn on the 'old-passwords' option for giving php the chance to connect to the MySQL-Server (see MySQL Documentation for details). Maybe the best place to do this is in the MySQL-Configuration file ('my.ini' found in the MySQL Program folder). In the [mysqld] section of the my.ini file add a line in saying: old-passwords Then restart the service MySQL to get the change loaded.

MySQL testing
Next, open a command prompt. With luck, the commands NET START MYSQL and NET STOP MYSQL should set the service running and kill it. If you get errors, look carefully at the edits you made, and the paths and files you have given.

Apache setup
All thats needed is to edit httpd.conf. The default location is: C:\Program Files\Apache Software Foundation\Apache2.2\httpd.conf

Main tasks: Look for the line in httpd.conf that starts with ServerRoot, and change it if necessary. ServerRoot "C:/Program Files/Apache Group/Apache2"
 * Tell apache where to serve documents from
 * Add modules to access PHP ("php5apache2.dll")
 * Enable apache monitoring
 * Set the PHPIniDir (if you didn't put php.ini into C:\Windows)
 * Add a server and domain ID (if you didnt give one during install,and now want to)
 * Tell apache to serve files called index.php and other documents as HTML
 * Restrict what information apache gives out about itself
 * Set up aliases (eg MYDOMAIN/wiki --> your wiki folder)
 * Set up permissions (who can access and execute code in different folders)
 * Set up web page serving to allow monitoring and info viewing
 * Odds and ends - add descriptions, compression handling, server side images, localisation, etc, if desired.

See the example below for a sample of a working http.conf.

Note - I had a problem with DocumentRoot and DirectoryIndex, solved by moving them further up the config file, above all the Directory and alias definitions. I dont know why this happened.

Note - don't let yourself be confused by the above. The sections further above tell you everything that has to be changed in the httpd.conf. This part seems to be a sort of reprise mixed with hints what to think of when setting up a web server.

Apache testing
Note that apache loads PHP as a module. But we haven't configured or tested PHP yet. So comment out the line: LoadModule php5_module "C:/Program Files/Php/php5apache2.dll" for now.

Next, open a command prompt. With luck, the commands NET START APACHE2 and NET STOP APACHE2 should set the service running and kill it. If you get errors, look carefully at the edits you made, and the paths and files you have given. Be careful - it is APACHE2, not just APACHE.

Note: If you're using apache2.2, you MUST download PHP5.2 dev build from http://snaps.php.net/ otherwise you'll get not found or access denied errors when putting the above line into httpd.conf. With PHP5.2 and apache2.2, do not use the PHPIniDir line.

Firewall and windows issues
Apache uses port 80, and MySQL uses port 3306. You may not want MySQL to be externally accessible, but you will probably want apache to be. So you'll have to open your firewall for these programs. Good luck - it took me some time but I can confirm that it works!

Sample config files
These are samples only, so that if in doubt, you can see how certain commands and directives are used.

Apache sample httpd.conf
The contents of this section can be found at this subarticle location: Newcomers guide to installing on Windows/Apache httpd.conv. [mysqld] basedir=D:/mysql datadir=D:/mysql/data [WinMySQLadmin] Server=D:/mysql/bin/mysqld-nt.exe user=siamcafe password=86I[v,
 * 1) bind-address=203.146.249.152
 * 1) language=D:/mysql/share/your language directory
 * 2) slow query log#=
 * 3) tmpdir#=
 * 4) port=3306
 * 5) set-variable=key_buffer=16M

max_connections = 500 key_buffer = 16M myisam_sort_buffer_size = 64M join_buffer_size = 1M read_buffer_size = 1M sort_buffer_size = 2M table_cache = 1024 thread_cache_size = 64 wait_timeout = 1800 connect_timeout = 10 max_allowed_packet = 16M max_connect_errors = 10 query_cache_limit = 1M query_cache_size = 32M query_cache_type = 1 skip-innodb [mysqld_safe] open_files_limit = 8192 [mysqldump] quick max_allowed_packet = 16M

[myisamchk] key_buffer = 64M sort_buffer = 64M read_buffer = 16M write_buffer = 16M

PHP sample php.ini
The contents of this section can be found at this subarticle location: Newcomers guide to installing on Windows/PHP php.ini