Manual:Installing MediaWiki on Windows Server 2008
From MediaWiki.org
![]() |
The content of this page has not been verified. Instructions written in this page have not been verified to be correct. If there are any inaccuracies, please drop a note at the support desk. |
![]() |
It has been suggested that this page or section be merged with Manual:Installing MediaWiki. (Discuss) |
This guide shows how to install MediaWiki on a computer running Windows Server 2008 SP1. The guide is not complete and hasn't fully tested.
An article written by a program manager at Microsoft, should be useful in helping get IIS 7.0 and PHP working on a server.
You will need to use the tutorial on installing MediaWiki onto Windows 2003 for the rest of the installation process.
Overview[edit | edit source]
A quick and dirty overview for Server 2008 & local MySql. 2008 R2 is not tested and may differ.
- PHP
- Grab a Zip archive of a VC9 compiled version of PHP (e.g. from here) and unzip it into C:\PHP.
- Create two subdirs: c:\PHP\sessiondata and c:\PHP\uploadtemp.
- Grant modify rights to the IUSR account for the subdirs.
- Copy php.ini-recommended as php.ini
- Edit php.ini and make the following changes. Most of the keys should be in the confitall Web server role. Make sure to select CGI and HTTP Redirection options.
- Install IIS Admin pack: http://www.iis.net/expand/AdministrationPack. (Note that this is not needed for IIS 7.5 as the Admin pack features are already integrated.)
- Launch IIS Manager and select the server.
- Open Handler Mappings
- Select Add Module Mapping. Enter the following values:
Path = *.php, Module = FastCgiModule, Executable = c:\php\php-cgi.exe, Name = PHP via FastCGI.
-
- Answer Yes to the question about creating a FastCGI application for the executable.
- Create a test page into wwwroot directory: phpinfo.php and set the contents like this:
<?php phpinfo(); ?>
- Fire up a browser, preferably on remote machine and load the phpinfo.php.
- If you receive an error message about the timezone not being set, then set the proper timezone in php.ini and restart IIS. If you still receive this message, then the PHP system cannot find the php.ini file. In this case, install and run PHP Manager For IIS, allow it to optimize the PHP settings, then phpinfo.php should work properly.
- If you receive a 500 error with error code 0x800736b1, the problem can be solved by installing the Microsoft Visual C++ Redistributable. The version you need (x86, x64) depends on the version of PHP you have installed, and you may also need to install one or both 2008/2010 packages depending on your version of PHP (5.2, 5.3, 5.4).
- If you receive session errors, edit the session.save_path in php.ini to be "c:\php\sessiondata"
- Return to IIS Manager and select the server.
- Open FastCGI Settings.
- Edit php-cgi.exe settings.
- Set an environment variable PHP_FCGI_MAX_REQUESTS and assign a value of 10000.
- Set InstanceMaxRequests value to 10000 too.
- Set index.php as a default document.
- MySQL
- Close all running programs, browsers, etc. If you do not, the MySQL installation may hang at the last step while applying the configuration.
- Install MySql and pick the Typical settings.
- Configure MySql
- Select Detailed
- Select Developer machine
- Select Multifunction database
- Select path for DB files
- Select DSS/OLAP
- Enable TCP. If remote server, add firewall exception
- Select standard charset
- Select service install and put binaries into path
- Assign root password
- Exit the command prompt and launch a new one to get MySql binaries into the path.
- Not needed for MySql 5.0 or newer Edit my.ini
Look for header [mysqld] and add directive old-passwords- Restart MySql: net stop mysql && net start mysql
- Query the database: mysqlshow -u root -p (password will be prompted). This is to check that MySql is up and running.
- Not needed for MySql 5.0 or newer Logon to the database and change password hashing:
mysql -u root -p (passwd'll prompted) UPDATE mysql.user SET Password = OLD_PASSWORD('new_password') WHERE Host = 'localhost' AND User = 'root'; FLUSH PRIVILEGES;
- MediaWiki
- Extract MediaWiki into inetpub\wwwroot\Mediawiki dir
- Note on IIS unless you extract it into a folder called mediawiki you will get PHP errors in the log once the configuration step is completed.
- For example you could have the below configuration if it needed to tie in with your share/folder naming policy as many of us corporates do.
- c:\shares\lws-wiki\mediawiki and then point the IIS instance directly at the folder.
- Grant the IUSR account (or the IIS_IUSRS group) modify rights to Mediawiki directory's subdirs \mw-config and \images
- NB! the config dir right MUST be revoked later on.
- Launch a browser and click the Configure link.
- Configure the Wiki, see other guides about this part
- Move config\LocalSettings.php file into Mediawiki dir.
- Revoke IUSR rights to the config dir
- If file uploads are needed, edit the LocalSettings.php like, say, this:
$wgEnableUploads = true; $wgFileExtensions = array('png', 'gif', 'jpg', 'jpeg', 'doc', 'xls', 'mpp', 'pdf', 'ppt', 'tiff', 'bmp', 'docx', 'xlsx', 'pptx', 'ps');
Known issues[edit | edit source]
- File uploads with international characters like å, ä, ö, è, ñ etc won't work. PHP/IIS combination wrecks UTF-8 and the file names will contain garbage sequences.
- Work-around: strip any accents: ä->a, å->a, è->e and so on when uploading files.
- To automate the stripping do following addition into includes\GlobalFunctions.php (this is proven to work for MediaWiki version 1.16.5). Add this code into the function
function wfStripIllegalFilenameChars( $name ) {
http://stackoverflow.com/questions/2758736/multibyte-strtr-mb-strtr
$name = preg_replace('~&([a-z]{1,2})(?:acute|cedil|circ|grave|lig|orn|ring|slash|th|tilde|uml);~i', '$1', htmlentities($name, ENT_QUOTES, 'UTF-8')); return $name;
- MediaWiki's 404 page for non-existing wiki titles, allowing a user to add the title, is replaced with IIS 7's custom error page
- Work-around: add the following location section to the web.config file in your wiki's main dir. The web.config file should be there, since IIS stores your changes to the default document setting there.
<location path="relative_path_to_dir_containing_index.php"> <system.webServer> <httpErrors errorMode="DetailedLocalOnly" existingResponse="PassThrough" /> </system.webServer> </location>
Alternatively:
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <httpErrors errorMode="DetailedLocalOnly" existingResponse="PassThrough" /> </system.webServer> </configuration>