Manual:Installing MediaWiki on Windows Server 2016

From MediaWiki.org
Jump to: navigation, search
Installation guidesManual:Installation guide
FreeBSDManual:Running MediaWiki on FreeBSD
GNU/LinuxManual:Running MediaWiki on GNU/Linux
- ALT LinuxManual:Running MediaWiki on ALT Linux
- Arch LinuxManual:Running MediaWiki on Arch Linux
- DamnsmalllinuxManual:Running MediaWiki on Damnsmalllinux
- Debian or UbuntuManual:Running MediaWiki on Debian or Ubuntu
- FedoraManual:Running MediaWiki on Fedora
- GentooManual:Running MediaWiki on Gentoo Linux
- MandrivaManual:Running MediaWiki on Mandriva
- Red Hat Enterprise LinuxManual:Running MediaWiki on Red Hat Linux
- SlackwareManual:Running MediaWiki on Slackware Linux
Mac OS XManual:Running MediaWiki on Mac OS X
NetWareManual:Running MediaWiki on NetWare
SolarisManual:Running MediaWiki on Solaris
- Solaris 11 / opensolarisManual:Running MediaWiki on Solaris 11 / opensolaris
- Solaris 10Manual:Running MediaWiki on Solaris 10
WindowsManual:Running MediaWiki on Windows
- Windows Server 2016Manual:Installing MediaWiki on Windows Server 2016
on a stickManual:Wiki on a stick
- Uniform ServerManual:Installation on Uniform Server (Windows)
- XAMPPManual:Installing MediaWiki on XAMPP
Sourceforge.netManual:Installing MediaWiki on SourceForge.net

The goal of this guide is to give some a quick and easy way to install MediaWiki on a Windows Server 2016 environment.

Requirements[edit]

The following items will be required:

  • Administrative access to the Windows Server 2016 server
  • PHP non-thread safe zip (Available here.)
  • MySQL installer (The file mysql-[version]-winx64.msi should be available here.)
    • MariaDB can be used as an alternative (The file mariadb-[version]-winx64.msi should be available here.)
  • MediaWiki archive (The file mediawiki-[version].tar.gz should be available here.)
  • 7-Zip or your favorite decompression utility to extract MediaWiki
  • A Visual C++ Redistributable for Visual Studio, the required version is noted on the PHP download page. (Available here.)

Step-by-Step Instructions[edit]

Internet Information Services (IIS)[edit]

To install IIS follow the steps below:

  1. Open Server Manager, select Roles.
  2. Add the Web Server role and include the following:
  • Common HTTP Features -> HTTP Redirection
  • Application Development -> CGI.
  1. Open Edge and access http://localhost, it should bring up the IIS10 splash page.

Set Default Document[edit]

Set default document to index.php.

  1. Open the Internet Information Services (IIS) Manager, select the server name from the list.
  2. Double click on Default Document.
  3. Use Add in the Action pane and add index.php to the list.

Adding PHP as FastCGI application[edit]

Instructions from php.net, that page also contains a visual guide.

  1. Open Handle Mappings
  2. Select Add Module Mapping... in the Actions pane.
  3. Add *.php as Request path.
  4. Choose FastCgiModule as Module from the drop down list.
  5. Add the path to the php-cgi.exe file in the Executable field. (C:\PHP\php-cgi.exe in this example)
  6. Add PHP_via_FastCGI as name.
  7. Open the Request Restrictions menu and select File or folder.

PHP[edit]

To install PHP follow the steps below:

  1. Install the Microsoft Visual C++ Redistributable.
  2. Extract the PHP zip into to a location of your choice. In this example C:\PHP is used.
  3. Create the php.ini file by opening the php.ini-production file and saving it as php.ini.
  4. Open your C:\PHP\php.ini file in Notepad and uncomment the values below by removing the semi colon symbol (;). The following recommendations are from php.net.
    1. cgi.fix_pathinfo = 1 (Line 761)
    2. fastcgi.impersonate = 1 (Line 769)
    3. cgi.force_redirect = 0 (Line 741)
    4. fastcgi.logging = 0 (Line 773)
    5. extension=php_mysqli.dll (Line 787)
    6. extension=php_mbstring.dll (Line 876, required since 1.27)
    7. extension=php_curl.dll (Line 893, required since 1.28)
  5. In the same file, change the path for extension_dir to the location of the extension folder. (In this example: extension_dir = "c:\PHP\ext", on line 724)
  6. Edit permissions on the images directory of the MediaWiki installation and add IUSR with modify privileges.
  7. Edit permissions on the temp directory of windows (C:\Windows\Temp) and add IUSR with modify privileges.
  8. Create a file called C:\inetpub\wwwroot\phpinfo.php, include the lines below.
  9. Open Internet Explorer and access http://localhost/phpinfo.php, it should bring up a PHP information page.
Contents of file PHPInfo.php
 <?php date_default_timezone_set('Europe/Berlin'); ?>

 Current Identity : <?php echo get_current_user();?>
 <?php phpinfo(); ?>

Enable PHP Caching (Optional)[edit]

Currently not supported.

Database[edit]

MySQL[edit]

To install MySQL follow the steps below:

  1. Launch the installer, select Server only.
    1. After the installer finishes installation you will be prompted to run the MySQL Server Instance Configuration Wizard.
    2. Select Server Machine, then click Next
    3. Confirm Enable TCP/IP Networking and Add firewall exception for this port are checked, then click Next.
    4. Enter in root password, then click Next.
    5. Confirm Install as Windows Service is checked, then click Next.

MariaDB[edit]

To install MariaDB follow the steps below:

  1. Launch the installer and continue to Default instance properties.
    1. Enter in root password, then click Next.

MediaWiki[edit]

To install MediaWiki follow the steps below:

  1. Extract the media wiki archive into C:\inetpub\wwwroot\mediawiki directory.
  2. If you have just one .tar file, extract that file into the C:\inetpub\wwwroot\mediawiki directory.
  3. If you want MediaWiki to be the default website follow the optional instructions below.
  4. Configure MediaWiki by accessing the configuration URL (http://[server name]/mediawiki/mw-config/index.php).
  5. Follow guide for using the configuration script. Ignore the GNU diff3 not found error.

Create specific IIS website for MediaWiki (Optional)[edit]

Configure MediaWiki as the default website for a host name or an IP address.

  1. Select a name for the web site.
  2. Rename the C:\inetpub\wwwroot\mediawiki folder to C:\inetpub\wwwroot\[web site name].
  3. Open the Internet Information Services (IIS) Manager, open the server name from the list.
  4. Right click on Sites and choose Add Web Site....
    1. Enter the web site name in the Site Name field.
    2. Change the physical directory to C:\inetpub\wwwroot\[web site name].
    3. Add a host name for your website or select an IP address.
  5. Click OK to create the web site.

GNU diff3 Installation (Optional)[edit]

Install GNU diff3 files.

  1. Create directory GnuWin in C:\Program Files (x86).
  2. Navigate to DiffUtils website.
  3. Download the file diffutils-2.8.7-1-bin.zip.
  4. Extract to the C:\Temp directory.
  5. Copy the bin directory to C:\Program Files (x86)\GnuWin.
  6. Navigate to File website.
  7. Download the file file-5.03-bin.zip.
  8. Extract to the C:\Temp directory.
  9. Copy the bin directory to C:\Program Files (x86)\GnuWin.
  10. Update the LocalSettings.php located in C:\inetpub\wwwroot\[media wiki name].

Original LocalSettings.php

# Path to the GNU diff3 utility. Used for conflict resolution.
$wgDiff3 = "";

Updated LocalSettings.php

# Path to the GNU diff3 utility. Used for conflict resolution.
$wgDiff3 = "C:/Program Files (x86)/GnuWin/bin/diff3.exe";
# Use external mime detector
$wgMimeDetectorCommand = "C:/Program Files (x86)/GnuWin/bin/file.exe -bi"; 

Common Errors[edit]

  • No styling when installing MediaWiki: Set the permissions for the temp directory of windows (C:\Windows\Temp) and add IUSR with modify privileges.
  • IIS 500 Error code: Install the Microsoft Visual C++ Redistributable.

Notes[edit]

This installation was tested with versions:

  • Windows Server 2016
  • IIS 10
  • PHP 7.0.1+
  • MySQL 5.7.12 / MariaDB 10.1.18
  • MediaWiki 1.26+