Issue: Docker mediawiki gives 'LocalSettings.php not found' error, even though LocalSettings.php is in correct directory

OS Version/build

Ubuntu 19.10
Linux version 5.3.0-26-generic (buildd@lgw01-amd64-013) (gcc version 9.2.1 20191008 (Ubuntu 9.2.1-9ubuntu2)) #28-Ubuntu SMP Wed Dec 18 05:37:46 UTC 2019

Docker Version

19.03.3, build a872fc2f86

Mediawiki Image & Version

Mediawiki Docker Image
Version: 1.34.0

To Reproduce

1.) Open terminal
2.) Run sudo docker pull mediawiki
3.) Run docker run --name some-mediawiki -p 8080:80 -d mediawiki
4.) Navigate to http://localhost:8080 in browser
5.) Set up mediawiki server following set up guide and use SQLite for the database
6.) Download generated LocalSettings.php at end of mediawiki server set up
7.) Move LocalSettings.php to /var/lib/mediawiki/ directory, which contains index.php, as the mediawiki set up instructions specify
8.) Navigate to http://localhost:8080 in a browser again and receive the ‘LocalSettings.php not found’ error

Unsuccessful Attempts to Fix

1.) Move LocalSettings.php to just /var/lib/mediawiki/mw-config directory, which also contains an index.php file
2.) Put LocalSettings.php in both /var/lib/mediawiki and /var/lib/mediawiki/mw-config directories, each of which contains an index.php file
3.) Run sudo chmod 777 LocalSettings.php to give full permissions on LocalSettings.php
5.) Run sudo systemctl restart apache2 in a terminal to restart apache2
6.) Run sudo docker restart some-mediawiki to restart container in the hopes it would find LocalSettings.php

Anyone have any suggestions for how to fix this issue? Or for an alternative way to set up the mediawiki using Docker? Would using MariaDB/MySQL instead of SQLite solve this?

Try placing LocalSettings.php into /var/www/html (it is handy to have attached a volume to /var/www/html so you don’t need to go into the container filesystem), and make sure the container user (1000 in my case) has adequate privs (Looks like read is required and execute is not, unsure if write is necessary but mine has 664 which gives both read & write).

1 Like

That fixed it! I just put 777 permissions on LocalSettings.php and copied it to the /var/www/html directory in the container.

Thanks @cincitech, I appreciate it! Cheers!

1 Like