This post is part of a series of posts about MediaWiki on Windows :
- Installing MediaWiki on Windows Server 2012 R2 Core
- Installing VisualEditor for MediaWiki on IIS
- Enabling Media / File Uploads For MediaWiki on Windows Server
- Install Server 2012 R2 Core on a machine or VM
- Install IIS using powershell
- Install Microsoft Web Platform Installer (WebPI)
- To download use the following powershell commandline :
wget http://download.microsoft.com/download/C/F/F/CFF3A0B8-99D4-41A2-AE1A-496C08BEB904/WebPlatformInstaller_amd64_en-US.msi -outfile webpi.msi
- !!! The above link is for Web PI v5.0 x64 which is the latest at the time of writing !!!
- Install the downloaded msi file
.\webpi.msi
- To download use the following powershell commandline :
- Install Media Wiki using webpicmd
- Test the installation
- Go to http://ip.of.machine/mediawiki in a browser you should see
- At the next page i encountered a problem, the css didnt load
- 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
- Get an object representing the permissions of “C:\inetpub\wwwroot\mediawiki” folder
- I reloaded the wiki page in my browser and the CSS loaded properly
- !!! 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 !!!
- “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 : https://www.mediawiki.org/wiki/Extension:WikiEditor
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 127.0.0.1 to force the use of ipv4
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.
Thanks
LikeLike
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. https://www.mediawiki.org/wiki/Manual:LocalSettings.php
LikeLike
Hey fam, thanks for the reply, I figured that out 🙂
It’s done using parameters file param.app,
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 🙂
LikeLike
hi sohail i would like that file if thats possible ? 🙂
LikeLike
ok, here you go bruv.
https://app.box.com/s/24vsrg1x0z02l33zi50oodb8dxdejfhm
Lemme know if you cannot download it, i’ll write in the contents in the comment section 🙂
LikeLike
Sorry i took a while to approve this, missed it 😦
LikeLike