I use Ubuntu 20.04, Apache/2.4.41 (Ubuntu), PHP 8.0.3 and mediawiki-1.35.1. I extracted mediawiki-1.35.1 archive in /var/www/html/, created symbolic link to its contents in another directory, for example var/www/html/m1:

$ ln -s /var/www/html/mediawiki-1.35.1/* /var/www/html/m1/

Then I pointed my browser to localhost/m1 and set up the wiki in regular way and put downloaded LocalSettings.php in var/www/html/m1. Then again I pointed my browser to localhost/m1 but the result was:

MediaWiki 1.35.1
LocalSettings.php not found.
Please set up the wiki first.

Then I moved downloaded LocalSettings.php to /var/www/html/mediawiki-1.35.1 and now localhost/m1 shows the main page of wiki. That is strange; because I think symbolic links must work as their target.

Really I want to set up multiple wikis on the same server. Previously I did what I described in Ubuntu 16.04 and mediawiki-1.30.0 and that worked. Now I want to know how I can fix that problem without needing to do the complex instructions of creating wiki family?


Your LocalSettings.php is included, ultimately, by /var/www/html/mediawiki-1.35.1/index.php: this is the PHP program that runs. It looks for included files in its home directory, which is /var/www/html/mediawiki-1.35.1, not in another directory that happens to contain a symbolic link to index.php.

  • Mediawiki uses dirname( __FILE__ ) to determine what directory it is running from. It isn't like the directory is hard coded into index.php. I'd think that a symbolic link could cause that function to output the directory that contains the symlink. Mar 22 at 9:12
  • 1
    stackoverflow.com/a/3304606/6632736 says that __FILE__ resolves symlinks and $_SERVER["SCRIPT_FILENAME"] doesn't, which is what I would expect. Mar 22 at 9:41
  • @StephenOstermiller OK! But how I can solve the problem? Mar 22 at 14:23
  • @AlexanderMashin I added main part of index.php to the question. How I can solve the problem? Mar 22 at 14:28

I removed symlinks to includes/, load.php and index.php of /var/www/html/mediawiki-1.35.1/ and copy them to the /www/html/m1. This solved the problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.