Manual:Installing MediaWiki on Windows Server 2019

This configuration is in progress with versions (25/02/2021):
 * Microsoft Windows Server 2019
 * Apache 2.4.46 (Win64)
 * PHP 7.4.15
 * MySQL 8.0.23 (community distribution) ;
 * MediaWiki 1.35.1

The goal of this guide is to give us a quick and easy overview on MediaWiki installation on Windows Server 2019.

Requirements
The following items will be required:
 * Administrator permissions
 * https://windows.php.net/download#php-7.3 PHP 7.3.19 Non-Thread Safe Zip for Windows]
 * https://dev.mysql.com/downloads/ MySQL Community Downloads
 * https://www.mediawiki.org/wiki/Compatibility MediaWiki
 * MediaWiki
 * Extraction software such as Bandizip
 * Visual C++ Redistributable Packages or Visual Studio

Set Default Document
Set default document to index.php.
 * Add index.php and move it to top of the list.

MediaWiki Part 1

 * 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:\wamp\www\mediawiki directory.
 * 3) Edit permissions on the images directory of the MediaWiki installation and add IUSR with modify privileges.

PHP
To install PHP follow the steps below:
 * 1) Install the Microsoft Visual C++ Redistributable. (see PHP site for specific version)
 * 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 . Line numbers depend on version. Newer versions use the format  instead of   for the extensions. (line numbers as of PHP 7.4.29)
 * 5) extension_dir = "ext" (Line 761)
 * 6) cgi.force_redirect = 1 (Line 778)
 * 7) cgi.fix_pathinfo = 1 (Line 798)
 * 8) fastcgi.impersonate = 1 (Line 810)
 * 9) fastcgi.logging = 0 (Line 814)
 * 10) extension=curl (Line 914)
 * 11) extension=fileinfo (Line 917)
 * 12) extension=gd2 (Line 918)
 * 13) extension=intl (Line 921)
 * 14) extension=mbstring (Line 924)
 * 15) extension=mysqli (Line 926)
 * 16) extension=openssl (Line 929)
 * 17) extension=pdo_sqlite (Line 935)
 * 18) extension=pgsql (Line 936)
 * 19) extension=sockets (Line 944)
 * 20) extension=sqlite3 (Line 946)
 * 21) Edit permissions on the temp directory of windows (C:\Windows\Temp) and add IUSR with modify privileges.
 * 22) Create a file called C:\inetpub\wwwroot\phpinfo.php, include the lines below.
 * 23) Open web browser and access http://127.0.0.1/phpinfo.php, it should bring up a PHP information page. (If using IIS, this step won't work until IIS has been configured to run PHP)
 * Contents of file PHPInfo.php

IIS

 * 1) Add environment variable for php
 * 2) Under Control Panel, System, Advanced system settings, Environment Variables..., System variables, select path variable and click on Edit
 * 3) Click on New button and add the PHP binary path. In this example C:\PHP is used.
 * 4) Install CGI
 * 5) Open Server Manager.
 * 6) On the Dashboard, under "Configure this local server" choose "Add roles and features"
 * 7) Click through to "server roles"
 * 8) Ensure that CGI is selected under "Web Server (IIS) -> Web Server -> Application Development"
 * 9) Add module mapping
 * 10) Open IIS
 * 11) Click on the server name
 * 12) Double-click handler mappings
 * 13) click add module mapping
 * 14) Set request path to "*.php"
 * 15) Module to "FastCgiModule"
 * 16) Executable to "php-cgi.exe" specifically " C:\PHP\php-cgi.exe" in this example.
 * 17) Set a name; for example php7.3

IIS should now be able to run php scripts. Open web browser and perform PHP step 7 to view the PHP information page.

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

MediaWiki Part 2
To install MediaWiki follow the steps below:
 * 1) If you want MediaWiki to be the default website follow the optional instructions below.
 * 2) Configure MediaWiki by accessing the configuration URL.
 * 3) Follow guide for using the configuration script.  Ignore the GNU diff3 not found error.

Create specific IIS website for MediaWiki (Optional)
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:\etpub\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....
 * 5) Enter the web site name in the Site Name field.
 * 6) Change the physical directory to C:\inetpub\wwwroot\[web site name].
 * 7) Add a host name for your website or select an IP address.
 * 8) Click OK to create the web site.

Common Errors

 * No styling when installing MediaWiki: Set the permissions for the temp directory of windows (C:\Windows\Temp) and add IUSR with modify privileges.