I've upgraded from Ubuntu 14.04 to 16.04 and I've found that there's no mediawiki package, because Debian dropped it in December 2015 for being out-of-date and nobody wanted to maintain it.

I had a working MediaWiki installation yesterday, and after upgrading, now I don't. How can I get it back up and running?

  • I don't quite understand... You asked a question for the sole purpose of immediately answering it yourself? I guess I don't know the rules of askubuntu, but it doesn't seem to be the right way to use a Q&A site? Anyway, there are many web sites that talk about how to install Mediawiki from source. Your answer doesn't really address your question -- what to do with a 16.04 upgrade.
    – Ray
    Commented Apr 23, 2016 at 16:28
  • 3
    It's OK to ask and answer your own questions -- the whole point is that I want to share what I had to do to get MediaWiki back after upgrading to Ubuntu 16.04, which removed it, because I want to help anyone else in the same situation. If you could be more specific about how my answer doesn't address the question, I can improve the answer. Please don't just downvote, it only means the answer will be less visible to anyone else who had this problem. Commented Apr 23, 2016 at 20:46
  • My apologies -- it seems OK to to answer your own questions. I'm a bit disappointed since there are other places where one can do that.
    – Ray
    Commented Apr 25, 2016 at 1:32
  • If you want to help others, why not contribute to the the official documentation instead of asking yourself a question? For example, help update this: help.ubuntu.com/community/MediaWiki . Or even contribute to the upstream Mediawiki help pages. Either should have better exposure and you don't need to ask people to not downvote.
    – Ray
    Commented Apr 25, 2016 at 1:36
  • @Ray seems to have too much time in a day to simply read or even to simply help... I appreciate what Stuart did, it helped me out.
    – MensSana
    Commented Sep 11, 2018 at 20:14

1 Answer 1


This answer presumes you're willing to maintain MediaWiki yourself from now on.

Also, it will install MediaWiki in the real document root of your web server. Previously, that will have been an alias, and the real installation path will have been under /var/lib/mediawiki, but as it's now up to you to maintain it instead of the Debian/Ubuntu maintainers, it's simplest to put it under its real path.

In this answer, the website's document root is /srv/apache2/public_html and the location of the wiki on the web server is /wiki (e.g. http://myserver/wiki), making the full path /srv/apache2/public_html/wiki. You'll need to adapt these paths to fit your own setup.

Download the latest MediaWiki and unpack it directly to the path it should have on your web server.

wget https://releases.wikimedia.org/mediawiki/1.26/mediawiki-1.26.2.tar.gz
tar xvf mediawiki-1.26.2.tar.gz
mv mediawiki-1.26.2 /srv/apache2/public_html/wiki
cd /srv/apache2/public_html/wiki
chown -R www-data:www-data .

Edit the file LocalSettings.php and change the settingMW_INSTALL_PATH from /var/lib/mediawiki to the new path.

Do the same in the file /etc/apache2/conf-available/mediawiki.conf

If you uploaded any images to your wiki, you'll have an images directory in /var/lib/mediawiki. Copy it to the new installation directory:

cp -a /var/lib/mediawiki/images .

You'll find that several of the PHP packages that MediaWiki relies on aren't installed for PHP 7, which is the new standard PHP version for Ubuntu 16.04. MediaWiki works fine with PHP 7, but you need to install these packages manually and enable them:

apt-get install libapache2-mod-php7.0 php-apcu php-gd php-json php-mysql php-xml
phpenmod apcu gd json pdo_mysql dom
a2enmod php7.0
a2enconf mediawiki

I used APC for caching, and I found that MediaWiki uses the traditional APC module, which isn't included with PHP 7. I fixed this by using the APCu module instead. In MediaWiki's code, replace apc_* calls with apcu_* calls:

sed -i 's/apc_/apcu_/g' includes/libs/objectcache/APCBagOStuff.php
sed -i 's/apc_/apcu_/g' includes/objectcache/ObjectCache.php

Run the upgrade script to update MediaWiki's database structure:

cd maintenance/
php update.php

If the database user you use for the wiki doesn't have the permissions to modify the database structure, the script will fail. Use the script's --dbuser and --dbpass options to supply a MySQL user with more privileges. If you have an AdminSettings.php file, use the details in there -- MediaWiki no longer reads this file itself, and you should delete this file from now on.

Now it should be possible to restart Apache and see your wiki on your website:

service apache2 restart

One last problem I had appeared when visiting my wiki: MediaWiki 1.25+ disabled skin auto-discovery and I was told to add an explicit wfLoadSkin( 'Vector' ); to my LocalSettings.php.

  • I see mention of an APC compatibility module for PHP7 at php.net/manual/en/apcu.installation.php. Do you know of a way to enable for use by MediaWiki in Ubuntu 16.04 without modifying sources? Commented May 2, 2016 at 22:36
  • 1
    As far as I can tell, Ubuntu has standardised on PHP 7.0, and while it packages a lot of the optional PHP modules (gd, json, curl, etc. -- see apt-cache search php7), they chose not to package the PHP 7.0 apc module. They only package APCu. That's why I chose to change the MediaWiki sources to use APCu. I could also have rebuilt php7 from Ubuntu sources and enabled the APC module, or I could've used a different caching backend, but I chose what I thought was simplest. Commented May 3, 2016 at 10:14
  • 1
    another package would be php-mbstring i would think
    – hpavc
    Commented May 8, 2016 at 16:15
  • Extension to Stuart's answer: I'm runnningt Mediawiki against Postgresql under Kubuntu. Doing no preparational package installs, update.php did only complain about php-xml and php-mbstring — but finally failed with "no database connection". After hours of debugging I then found that php-pgsql had been removed as well! Unfortunately, the respective error message will not make it through all the layers of compatibility Mediawiki built. :-( With these just three packages installed again, update.php finished correctly. But Apache had lost libapache2-mod-php as well …
    – Mnyromyr
    Commented Sep 20, 2016 at 21:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .