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.

fastcgi.impersonate = 1 cgi.fix_pathinfo = 1 cgi.force_redirect = 0 open_basedir = "c:\inetpub\wwwroot;c:\PHP\uploadtemp;C:\PHP\sessiondata" extension = php_mysql.dll extension_dir = "./ext" upload_tmp_dir = C:\PHP\uploadtemp session.save_path = C:\php\sessiondata
 * 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 config file, but are commented.
 * IIS
 * 1) Install Web server role. Make sure to select CGI and HTTP Redirection options.
 * 2) Install IIS Admin pack: http://www.iis.net/expand/AdministrationPack
 * 3) Launch IIS Manager and select the server.
 * 4) Open Handler Mappings
 * 5) Select Add Module Mapping. Enter the following values: Path = *.php, Module = FastCgiModule, Executable = c:\php\php-cgi.exe, Name = PHP via FastCGI.
 * 6) Answer Yes to the question about creating a FastCGI application for the executable.
 * 7) Create a test page into wwwroot directory: phpinfo.php and set the contents like this: &lt;?php phpinfo; ?&gt;
 * 8) Fire up a browser, preferably on remote machine and load the phpinfo.php.
 * 9) Return to IIS Manager and select the server.
 * 10) Open FastCGI Settings.
 * 11) Edit php-cgi.exe settings.
 * 12) Set an environment variable PHP_FCGI_MAX_REQUESTS and assign a value of 10000.
 * 13) Set InstanceMaxRequests value to 10000 too.
 * 14) Set index.php as a default document.


 * MySQL
 * 1) Install MySql and pick the Typical settings.
 * 2) Configure MySql
 * 3) Select Detailed
 * 4) Select Developer machine
 * 5) Select Multifunction database
 * 6) Select path for DB files
 * 7) Select DSS/OLAP
 * 8) Enable TCP. If remote server, add firewall exception
 * 9) Select standard charset
 * 10) Select service install and put binaries into path
 * 11) Assign root password
 * 12) Exit the command prompt and launch a new one to get MySql binaries into the path.
 * 13) Not needed for MySql 5.0 or newer Edit my.ini Look for header [mysqld] and add directive old-passwords
 * 14) Restart MySql: net stop mysql && net start mysql
 * 15) Query the database: mysqlshow -u root -p (password will be prompted). This is to check that MySql is up and running.
 * 16) 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 \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.