Manual:Installing MediaWiki on Windows Server 2016
Appearance
The goal of this guide is to give a quick way to install MediaWiki on a Windows Server 2016 environment. This installation does not need Apache web service to be installed. It can also be used to install MediaWiki on Windows Server 2019.
Requirements
[edit]The following items will be required:
- Administrator permission
- PHP Non Thread Safe Zip for Windows (64-bit)
- MariaDB or MySQL. MariaDB is the primary target for MediaWiki and is best supported. MediaWiki also works with MySQL and Percona Server, which are MariaDB compatible. PostgreSQL is a popular open source database system as an alternative to MySQL. SQLite is a lightweight database system that is very well supported.
- MediaWiki
- Software to extract the MediaWiki .zip installer file
- Visual C++ Redistributable Packages or Visual Studio (64-bit)
Instructions
[edit]Internet Information Services (IIS)
[edit]To install IIS follow the steps below:
- Open Server Manager, select Roles.
- Add the Web Server role and include the following:
- Common HTTP Features -> HTTP Redirection
- Application Development -> CGI.
- Once complete, open web browser and go to http://127.0.0.1/.
Set Default Document
[edit]Set default document to index.php.
- Open Internet Information Services (IIS) Manager and select the server name from the list.
- Go to Default Document.
- Add index.php and move it to top of the list.
PHP
[edit]To install PHP follow the steps below:
- Install the Microsoft Visual C++ Redistributable. For PHP 8+, Microsoft Visual C++ Redistributable current version (common for Visual Studio 2015, 2017, 2019, and 2022) has to be installed on the server.
- Extract the PHP zip into to a location of your choice. In this example C:\PHP is used.
- Create the php.ini file by opening the php.ini-production file and saving it as php.ini.
- Open your C:\PHP\php.ini file in Notepad and uncomment the values below by removing the semi colon symbol (;). Line numbers are specific for PHP 8.0.3, but depend on version. Newer versions use the format
extension=<ext>
instead ofextension='php_<ext>.dll
for the extensions.- extension_dir = "ext" (Line 770)
- cgi.force_redirect = 1 (Line 787)
- cgi.fix_pathinfo = 1 (Line 807)
- fastcgi.impersonate = 1 (Line 819)
- fastcgi.logging = 0 (Line 823)
- extension=curl (Line 923)
- extension=fileinfo (Line 926)
- extension=gd2 (Line 927)
- extension=intl (Line 930)
- extension=mbstring (Line 933)
- extension=mysqli (Line 935)
- extension=openssl (Line 939)
- extension=pdo_sqlite (Line 945)
- extension=pgsql (Line 946)
- extension=sockets (Line 954)
- extension=sqlite3 (Line 956)
- Edit permissions on the images directory of the MediaWiki installation and add IIS_IUSR with modify privileges.
- Edit permissions on the temp directory of windows (C:\Windows\Temp) and add IIS_IUSR with modify privileges.
- Adding PHP in IIS as FastCGI application (after installing PHP):
- Open Server Manager, select Tools, Internet Information Services (IIC) Manager
- Select on the left side under Start Page your server
- Open in Feature Views the icon Handler Mappings by double-click
- Select Add Module Mapping... in the Actions pane.
- Add *.php as Request path.
- Choose FastCgiModule as Module from the drop down list.
- Add the path to the php-cgi.exe file in the Executable field. (C:\PHP\php-cgi.exe in this example)
- Add PHP_via_FastCGI as name.
- Open the Request Restrictions menu and select File or folder.
- Create a file called C:\inetpub\wwwroot\phpinfo.php, include the lines below.
- Open web browser and access http://127.0.0.1/phpinfo.php, it should bring up a PHP information page.
- Contents of file phpinfo.php
<?php phpinfo();
Database
[edit]MySQL
[edit]To install MySQL follow the steps below:
- Launch the installer, select Server only.
- After the installer finishes installation you will be prompted to run the MySQL Server Instance Configuration Wizard.
- Select Server Machine, then click Next
- Confirm Enable TCP/IP Networking and Add firewall exception for this port are checked, then click Next.
- Enter in root password, then click Next. Do not use your administrator password or any other important password because MediaWiki writes the password in cleartext into LocalSettings.php!
- Confirm Install as Windows Service is checked, then click Next.
MariaDB
[edit]To install MariaDB follow the steps below:
- Launch the installer and continue to Default instance properties.
- Enter in root password, then click Next. Do not use your administrator password or any other important password because MediaWiki writes the password in cleartext into LocalSettings.php!
MediaWiki
[edit]To install MediaWiki follow the steps below:
- Extract the media wiki archive into C:\inetpub\wwwroot\mediawiki directory. Note: DO NOT USE 7zip, it does not deal with PAX and will leave you with a 500 error on config. See: Topic:Vp73pxywm362a3t5
- If you have just one .tar file, extract that file into the C:\inetpub\wwwroot\mediawiki directory.
- If you want MediaWiki to be the default website follow the optional instructions below.
- Configure MediaWiki by accessing the configuration URL (
http://[server name]/mediawiki/mw-config/index.php
). - 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.
- Select a name for the web site.
- Rename the C:\inetpub\wwwroot\mediawiki folder to C:\inetpub\wwwroot\[web site name].
- Open the Internet Information Services (IIS) Manager, open the server name from the list.
- Right click on Sites and choose Add Web Site....
- Enter the web site name in the Site Name field.
- Change the physical directory to C:\inetpub\wwwroot\[web site name].
- Add a host name for your website or select an IP address.
- Click OK to create the web site.
GNU diff3 Installation (Optional)
[edit]Install GNU diff3 files.
- Create directory GnuWin in C:\Program Files (x86).
- Navigate to DiffUtils website.
- Download the file diffutils-2.8.7-1-bin.zip.
- Extract to the C:\Temp directory.
- Copy the bin directory to C:\Program Files (x86)\GnuWin.
- Navigate to File website.
- Download the file file-5.03-bin.zip.
- Extract to the C:\Temp directory.
- Copy the bin directory to C:\Program Files (x86)\GnuWin.
- 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.
- 500 Error code on initial configuration (
http://[server name]/mediawiki/mw-config/index.php
). page: Topic:Vp73pxywm362a3t5 - Error 1025/Errno. 13 whilst running installation script: ensure that the Application Pool being used by the wiki website is set as follows - Net CLR Version = No Managed Code; Managed Pipeline Mode = Classic
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+