Manual:Installing MediaWiki on Windows Server 2019
The goal of this guide is to give a quick overview on MediaWiki installation on Windows Server 2019.
Requirements
editThe following items will be required:
- Administrator permissions
- https://windows.php.net/download PHP Non-Thread Safe Zip for Windows] (see Compatibility#PHP) for version requirements)
- https://dev.mysql.com/downloads/ MySQL Community Downloads
- MediaWiki
- Software to extract the MediaWiki .zip installer file
- Visual C++ Redistributable Packages or Visual Studio
Instructions
editApache
editSet Default Document
editSet default document to index.php.
- Add index.php and move it to top of the list.
MediaWiki Part 1
edit- Extract the media wiki archive into C:\inetpub\wwwroot\mediawiki directory.
- If you have just one .tar file, extract that file into the C:\wamp\www\mediawiki directory.
- Edit permissions on the images directory of the MediaWiki installation and add IUSR with modify privileges.
PHP
editTo install PHP, follow the steps below:
- Install the Microsoft Visual C++ Redistributable. (see PHP site for specific version)
- 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 depend on version. Newer versions use the format
extension=<ext>
instead ofextension='php_<ext>.dll
for the extensions. (line numbers as of PHP 7.4.29)extension_dir = "ext" # Line 761 cgi.force_redirect = 1 # Line 778 cgi.fix_pathinfo = 1 # Line 798 fastcgi.impersonate = 1 # Line 810 fastcgi.logging = 0 # Line 814 extension=curl # Line 914 extension=fileinfo # Line 917 extension=gd2 # Line 918 extension=intl # Line 921 extension=mbstring # Line 924 extension=mysqli # Line 926 extension=openssl # Line 929 extension=pdo_sqlite # Line 935 extension=pgsql # Line 936 extension=sockets # Line 944 extension=sqlite3 # Line 946
- Edit permissions on the temp directory of windows (C:\Windows\Temp) and add IUSR with modify privileges.
- 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. (If using IIS, this step won't work until IIS has been configured to run PHP)
- Contents of file PHPInfo.php
<?php phpinfo(); ?>
IIS
edit- Add environment variable for php
- Under Control Panel, System, Advanced system settings, Environment Variables..., System variables, select path variable and click on Edit
- Click on New button and add the PHP binary path. In this example C:\PHP is used.
- Install CGI
- Open Server Manager.
- On the Dashboard, under "Configure this local server" choose "Add roles and features"
- Click through to "server roles"
- Ensure that CGI is selected under "Web Server (IIS) -> Web Server -> Application Development"
- Add module mapping
- Open Internet Information Services (IIS) Manager
- Click on the server name in the left hand tree menu
- Double-click handler mappings
- click add module mapping in the menu on the right of the window or in the right click popup menu
- Set request path to "*.php"
- Module to "FastCgiModule"
- Executable to "php-cgi.exe" specifically " C:\PHP\php-cgi.exe" in this example.
- Set a name; for example php7.3
- Secure the images directory
- Create a web.config file in inetpub/wwwroot to disable execution of PHP scripts The file contents should be similar to
<?xml version="1.0" encoding="UTF-8"?> <configuration> <location path="mediawiki/images"> <system.webServer> <security> <requestFiltering> <fileExtensions> <add fileExtension=".php" allowed="false" /> </fileExtensions> </requestFiltering> </security> </system.webServer> </location> </configuration>
- Create a web.config file in inetpub/wwwroot to disable execution of PHP scripts The file contents should be similar to
IIS should now be able to run php scripts. Open web browser and perform PHP step 7 to view the PHP information page.
Database
editMySQL
editTo 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.
- Confirm Install as Windows Service is checked, then click Next.
MediaWiki Part 2
editTo install MediaWiki follow the steps below:
- 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)
editConfigure 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)
editCommon 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.
Notes
editThis installation is testing with versions (18/06/2020):
- Windows Server 2019
- Apache 2.4.41
- PHP 7.3.19
- MySQL 5.7.29
- MediaWiki 1.34.1