Manual:Installing MediaWiki on Windows Server 2008

'Warning, this page is not complete or fully tested.'

The link below should be useful in helping get IIS 7.0 and PHP working on a server.

http://learn.iis.net/page.aspx/246/using-fastcgi-to-host-php-applications-on-iis-70/

You will need to use the tutorial on installing MediaWiki onto Windows 2003 for the rest of the installation process.

A guide
A quick and dirty overview for Server 2008 & local MySql. 2008 R2 is not tested and may differ.


 * PHP
 * 1) Grab a Zip archive of a VC9 compiled version of PHP (e.g. from here) and unzip it into C:\PHP.
 * 2) Create two subdirs: c:\PHP\sessiondata and c:\PHP\uploadtemp.
 * 3) Grant modify rights to the IUSR account for the subdirs.
 * 4) Copy php.ini-recommended as php.ini
 * 5) 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.

Path = *.php, Module = FastCgiModule, Executable = c:\php\php-cgi.exe, Name = PHP via FastCGI. &lt;?php phpinfo; ?&gt;
 * 1) 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.)
 * 2) Launch IIS Manager and select the server.
 * 3) Open Handler Mappings
 * 4) Select Add Module Mapping. Enter the following values:
 * 1) Answer Yes to the question about creating a FastCGI application for the executable.
 * 2) Create a test page into wwwroot directory: phpinfo.php and set the contents like this:
 * 1) Fire up a browser, preferably on remote machine and load the phpinfo.php.
 * 2) 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.
 * 3) 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).
 * 4) If you receive session errors, edit the session.save_path in php.ini to be "c:\php\sessiondata"
 * 5) Return to IIS Manager and select the server.
 * 6) Open FastCGI Settings.
 * 7) Edit php-cgi.exe settings.
 * 8) Set an environment variable PHP_FCGI_MAX_REQUESTS and assign a value of 10000.
 * 9) Set InstanceMaxRequests value to 10000 too.
 * 10) Set index.php as a default document.


 * MySQL
 * 1) Close all running programs, browsers, etc.  If you do not, the MySQL installation may hang at the last step while applying the configuration.
 * 2) Install MySql and pick the Typical settings.
 * 3) Configure MySql
 * 4) Select Detailed
 * 5) Select Developer machine
 * 6) Select Multifunction database
 * 7) Select path for DB files
 * 8) Select DSS/OLAP
 * 9) Enable TCP. If remote server, add firewall exception
 * 10) Select standard charset
 * 11) Select service install and put binaries into path
 * 12) Assign root password
 * 13) Exit the command prompt and launch a new one to get MySql binaries into the path.
 * 14) Not needed for MySql 5.0 or newer Edit my.ini Look for header [mysqld] and add directive old-passwords
 * 15) Restart MySql: net stop mysql && net start mysql
 * 16) Query the database: mysqlshow -u root -p (password will be prompted). This is to check that MySql is up and running.
 * 17) 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
 * 1) Extract MediaWiki into inetpub\wwwroot\Mediawiki dir
 * 2) 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.
 * 3) 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.
 * 1) Grant the IUSR account (or the IIS_IUSRS group) modify rights to Mediawiki directory's subdirs \mw-config and \images
 * 2) NB! the config dir right MUST be revoked later on.
 * 3) Launch a browser and click the Configure link.
 * 4) Configure the Wiki, see other guides about this part
 * 5) Move config\LocalSettings.php file into Mediawiki dir.
 * 6) Revoke IUSR rights to the config dir
 * 7) 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
$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;    
 * 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 ) {
 * 1) http://stackoverflow.com/questions/2758736/multibyte-strtr-mb-strtr
 * 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.

Alternatively:    