I had a few spare hours yesterday and had been meaning to try and recreate the MediaWiki docker container inside a FreeNAS jail. A few gotchas were found but they were resolved pretty quickly, and I now have my own APE Wiki!
It’s really just another FAMP (FreeBSD-Apache-MySQL-PHP) stack so I pretty much followed the LimeSurvey guide that I’d created on the FreeNAS forum here and which I blogged about here.
I actually created the jail from the WUI and then consoled in using SSH. I find it much easier to copy and paste things into a macOS Terminal windows that the WUI shell, even though it’s much improved in FreeNAS 11x.
I found a package for MediaWiki and went for the latest 1.34 version rather than the 1.31 LTS version and installed with pkg install mediawiki134-php74. I didn’t notice that it uninstalled MariaDB as part of the process, as it installs MySQL!
After installing what I thought was all the packages I required, and making the PHP and Apache configuration changes, I thought I’d try and access the jail. Apache was working but wasn’t serving any PHP, so something wasn’t quite right. After a little Googling, I realised that the mod_php74 pkg was missing from the MediaWiki package, as that included Lighttpd and I’ve never attempted to configure that so thought I’d install apache24. A quick restart of php-fpm and apache and PHP was working and I could see the installation screen.
I knew it wouldn’t work yet as I hadn’t configured the database, but thought I’d test things beyond the first screen, which identified a number of other issues. Easiest to fix was the missing APCu and ImageMagick, with the packages installed via pkg install php74-pecl-APCu ImageMagick7. I’d already added the configuration line into the PHP.ini file so that got those working.
The other error took a little more time to resolve and related to Gizzlehttp. I can’t remember the exact error (it spanned several lines) but I googled parts of it and got various different suggestions. One suggested a database error, which did flag up the uninstallation of the MariaDB package I’d installed earlier, but the MediaWiki pkg had removed. Reinstalling this remove the MediaWiki folder, and highlighted my lack of understanding exactly how packages work!
In the end, I managed to use pkg lock mediawiki134-php74 and then pkg install mariadb104 (which removed the MySQL-client conflict) although did not resolve the Grizzlehttp error! Further googling suggested a number of different solutions, not of which seemed relevant nor worked (at least the one I tried). It eventually turned out to be a very simple fix – another missing PHP module, this time resolved by pkg install php74-filter. I really should remember to check PHP modules first!!
After this, it was pretty plain sailing, and (almost) everything worked as expected. I configured a database and ran the installer again which got APE Wiki up and running. I reconfigured my SSL-proxy jail to create a new certificate and a secure connection (I’d used the sub-domain before, so didn’t need to redirect it to my server). Creating and adding a logo was pretty straight forward, editing the LocalSettings.php file and pointing it to the image at the top of this blog.
Getting a smaller version in the browser tab provided slightly more challenging, and simply copying to the root folder didn’t work. I ended up having to host this on another webserver I have running, as it needs to be in the favicon.ico format and WordPress can’t deal with that in a blog. Getting my webserver to serve it meant some changes to the configuration, although I got there in the end.
So that’s it. Not really sure what I’m going to do with it now it’s up and running, although I do like the Wikipedia platform, and it’s based around the MediaWiki software, so it would be good to learn a little about how it works. We’re still in lockdown and my contract has been extended for another month, so I still don’t have much spare time, although I did manage to waste a few hours getting APE Wiki up and running 😉
This page is also quite useful, although really out of date!
https://www.mediawiki.org/wiki/Manual:Running_MediaWiki_on_FreeBSD