Tuesday, June 30, 2020

Migrate Mediawiki to new version on westhost platform

Westhost ( https://www.westhost.com/ ) is my long time website hosting platform, recently upgraded their platform to utilize cpanel. They moved the mysql databases and site to new platform, but the wiki's i've been running earlier stopped working. I haven't been actively managing those wiki's so the software was quite old version 1.14 of Mediawiki than current 1.34.2
The platform also changed in many ways. Newer php 7.2.x, mariadb, cpanel.
So the old wiki's refused to work with newer php, and the sites went down!
I was left with many questions , in order to get sites working.
Primarily, How to make Mediawiki work with new php, and get the db also updated.?
So, this is what i tried:
Download new software-
https://www.mediawiki.org/wiki/Download
Read through its upgrading doc at  https://www.mediawiki.org/wiki/Manual:Upgrading
It looked like many LocalSettings.php(LS) parameters also changed, and i had no idea what would work. So, first thing, instead of upgrading existing wiki's. I installed a new wiki altogether, utilizing the install guide at https://www.mediawiki.org/wiki/Manual:Installation_guide#Main-installation-guide

The westhost's cpanel has ui for Mysql DB's - so created new Test db there and associated a new user to it. Cpanel's Metrics->Errors was useful to veiw errors as they happened. For some reason , apache's direct access to its log is not there in new platform?

So, after installing a new wiki, it had generated its new LS , which was now useful to compare to the very old wiki's parameters.

In order to upgrade, encountered quite a few issues, i'm documenting steps below to help anyone doing similar excercise:

Do a  http://www.yourdomain.com/phpinfo.php -> To see if php runs and what version.
extract mediawiki s/w
 wget https://releases.wikimedia.org/mediawiki/1.34/mediawiki-1.34.2.tar.gz
rename old wiki to wiki_old.. rename mediawiki to wiki
chmod -R g-w wiki
 cd wiki
 chmod -R 644 *.php */*.php

change LocalSettings parameters carefully
 add .htaccess with just -> DirectoryIndex index.php
copy old images, skins/common files from old wiki to new. 
Go to wiki/maintenance and run "php update.php" command. This fixes the DB to work with new version of mediawiki. ##IF this does not work try the web update..http://www.yourdomain.com/mw-config  ..that shows errors happening.. For me few extensions were outdated ,so without any error message , i couldn't figure out what's wrong. So used the web update, which showed those errors.


Do enable display errors feature from cpanel ->  Multiphp ini editor section -> display_errors; prior

Once update is done, the wiki should work normally. Thanks to Mediawiki folks for documenting so well, and making the s/w update smooth. I didn't think it would be possible to upgrade from such a old version.

LS parameters updated:
wgServer
Database settings
$wgDBTableOptions   = "ENGINE=InnoDB, DEFAULT CHARSET=binary";
#$wgDBmysql5  commented this
$wgMemCachedServers = [];
wfLoadSkin( 'MonoBook' );
wfLoadSkin( 'Timeless' );
wfLoadSkin( 'Vector' );
Extensions to:
wfLoadExtension( 'Cite' );
Comment/remove the $wgUpgradeKey  once the update is done.