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. (Note that this is not needed for IIS 7.5 as the Admin pack features are already integrated.)
 * 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) If you receive an error message about the timezone not being set, then set the proper timezone in php.ini.  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.
 * 10) 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).
 * 11) Return to IIS Manager and select the server.
 * 12) Open FastCGI Settings.
 * 13) Edit php-cgi.exe settings.
 * 14) Set an environment variable PHP_FCGI_MAX_REQUESTS and assign a value of 10000.
 * 15) Set InstanceMaxRequests value to 10000 too.
 * 16) 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 \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:    