Installing MediaWiki on Windows Server 2012 R2 Core

Guide on how to install Media Wiki on Windows Server, using Web PI.


This post is part of a series of posts about MediaWiki on Windows :

  1. Installing MediaWiki on Windows Server 2012 R2 Core
  2. Installing VisualEditor for MediaWiki on IIS
  3. Enabling Media / File Uploads For MediaWiki on Windows Server
  • Install Server 2012 R2 Core on a machine or VM
  • Install IIS using powershell
    • Install-WindowsFeature -Name Web-Server
    • iis_install_serv_core
  • Install Microsoft Web Platform Installer (WebPI)
  • Install Media Wiki using webpicmd
    • Change the directory to : C:\Program Files\Microsoft\Web Platform Installer
    • Run the following command to install the MediaWiki application
      • .\webpicmd /Install /Application:MediaWiki
    • Web Pi will ask you several questions (config options, usernames and password etc…) at the end you should see :
    • media_wiki_core_install
  • Test the installation
  • At the next page i encountered a problem, the css didnt load
    • media_wiki_missing_css
  • I opened up the source and clicked the link which should load the css, this returned :
    • Exception encountered, of type "Less_Exception_Parser" [ec4dcf50] /mediawiki/mw-config/index.php?css=1 Less_Exception_Parser from line 447 of C:\inetpub\wwwroot\mediawiki\vendor\oyejorge\less.php\lib\Less\Parser.php: Less.php cache directory isn't writable: C:\Windows\TEMP Backtrace: #0 C:\inetpub\wwwroot\mediawiki\includes\resourceloader\ResourceLoader.php(1620): Less_Parser->SetCacheDir(string) ...
  • MediaWiki is trying to write to “C:\Window\TEMP” but the user context that PHP is running in (via IIS) doesn’t have permission.
    • !!! This is what I did to resolve the issue, its highly not recommended – it would be better to isolate the MediaWiki temp folder somewhere else !!!
      • Get an object representing the permissions of “C:\inetpub\wwwroot\mediawiki” folder
        • $acl_web = get-acl "C:\inetpub\wwwroot\mediawiki"
      • Get an array of just the access rules for *IUSR*
        • $perms = $acl_web.access|?{$_.identityreference -like "*IUSR*"}
      • Get an object representing just the access permissions for the TEMP folder
        • $acl_temp = (get-item "C:\Windows\TEMP").GetAccessControl("Access")
      • Add the access rules from the mediawiki folder to the temp folder acl
        • $perms | %{$acl_temp.AddAccessRule($_)}
      • Set the TEMP folder permissions to the newly created acl object
        • Set-Acl -path "C:\Windows\TEMP" -aclobject $acl_temp
    • I reloaded the wiki page in my browser and the CSS loaded properly
  • “Installing” MediaWiki
    • Choose language options and continue
    • The next page told me that i was ready to install mediawiki.
    • At the next page, i added the same MySQL options as during the WebPI command line install of MediaWiki
    • I left the database settings as default
    • Next add a title and create yourself a user account
    • This page allows you to change the reply address on the emails sent by mediawiki and also select some extensions. I choose just WikiEditor
    • Download your “LocalSettings.php”
    • Now we need to get this LocalSettings.php file to the server and store it in the mediawiki root folder.
      • I am using a virtual machine, so I opened the file and copied the text – then on the vm i opened notepad, pasted the text and saved the file as “C:\inetpub\wwwroot\mediawiki\LocalSettings.php”
  • I went back to the main page and this time it took a little longer to load – but loaded the Wiki correctly (it didn’t try to take me through install again, meaning it had picked up the settings)
  • To fully enable the WikiEditor extension, I had to add some more lines to the LocalSettings.php file more information :

Page loading initially was very slow at about 10s per page! This was happening because the database was being access using the hostname – localhost. This brings the ipv6 stack into play, which for some reason slows everything down.

To fix this, change the $wgDBserver variable in LocalSettings.php to to force the use of ipv4

10 thoughts on “Installing MediaWiki on Windows Server 2012 R2 Core”

  1. Hi ,

    the media wiki part will ask you a lot of configuration questions.
    can you help with an idea of getting that thing done automatically.
    like how can i parse values to the installation while its running.



    1. Hi Sohail, I work in Software Deployment and normally a question like “help me set config options during install” is my bread and butter (easy). However, I have no experience in setting install options for web apps like this one. I did a little research and think you need to investigate the LocalSettings.php file – it is generated during the install process. I think you could create this file in advance and just overwrite it to avoid the initial config options after install.


      1. Hey fam, thanks for the reply, I figured that out 🙂
        It’s done using parameters file,
        Lemme know if u need it, I’ve done a lot of research on that one.
        The script I made will do the complete installation for u, unattended 🙂


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s