Bug 1718580 - "LocalSettings.php not found" despite being present
Summary: "LocalSettings.php not found" despite being present
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: mediawiki
Version: 30
Hardware: All
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Michael Cronenworth
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-06-08 19:23 UTC by Scott Schmit
Modified: 2019-09-13 22:33 UTC (History)
6 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2019-09-13 22:33:33 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Scott Schmit 2019-06-08 19:23:02 UTC
Description of problem:
Even though I have LocalSettings.php at the root of my mediawiki install, mediawiki insists it's not there.

After puzzling over my apache config, selinux, reinitializing my LocalSettings.php from scratch, numerous web searches, etc, I finally found this:
 
https://www.mediawiki.org/wiki/Topic:V0nhdqvg0boqdg75

Creating the symlink as described "fixes" the problem, though this obviously is unworkable for anyone with multiple parallel installations.

Version-Release number of selected component (if applicable):
mediawiki-1.32.1-1.fc30.noarch
mediawiki-1.32.2-1.fc30.noarch

How reproducible:
100%

Steps to Reproduce:
1. Install mediawiki page
2. Set up your wiki
3. Put your LocalSettings.php at the wiki root
4. Keep getting told that it's not there
5. Put another file next to LocalSettings.php
6. Load $SERVER/wiki/$file and see it
7. Add symlink from /usr/share/mediawiki/LocalSettings.php to $IP/LocalSettings.php
8. Wiki loads
9. rm /usr/share/mediawiki/LocalSettings.php
10. Get told that LocalSettings.php is missing

Actual results:
MediaWiki 1.32.2

LocalSettings.php not found.

Please complete the installation and download LocalSettings.php.

Expected results:
My wiki loads normally.

Additional info:

Comment 1 Michael Cronenworth 2019-06-08 22:43:41 UTC
Are you following the README.RPM instructions and using the 'mw-createinstance' script to initialize your instance?

It also has instructions to point your Apache config to the '$IP' directory. Are you following those instructions?

Comment 2 Scott Schmit 2019-06-09 20:20:51 UTC
I started out by doing an upgrade from a working installation (so I used mw-updateallinstances).

When that didn't work, I tried (among many things) reinitializing my instance from scratch: I generated a new LocalSettings.php from scratch, merging in settings from the original that weren't addressed by the mw-config helper/installer.

So I've done it both ways.

As for pointing my apache config at the $IP directory...  I didn't make the wiki a DocumentRoot, but I do have an "Alias /wiki /srv/.../wiki" directive.  Is that no longer sufficient?  That is one option described in the template /etc/httpd/conf.d/mediawiki.conf for setting up a mediawiki instance.

Comment 3 DaveG 2019-07-04 12:26:04 UTC
Looks like upstream *reverted* a change to support sym-linked includes...
https://phabricator.wikimedia.org/rMW3aa0b0567ff64ecb74df7534c8812c78c323df7c

The relevant snippet from includes.WebStart.php, version 1.31.0:

# Full path to working directory.
# Makes it possible to for example to have effective exclude path in apc.
# __DIR__ breaks symlinked includes, but realpath() returns false
# if we don't have permissions on parent directories.
$IP = getenv( 'MW_INSTALL_PATH' );
if ( $IP === false ) {
	$IP = realpath( '.' ) ?: dirname( __DIR__ );
}

Tried modifying my installation to match the old way but it breaks eveything else! index.php is not the only entry point.

Is there a way to set the MW_INSTALL_PATH environment variable from a .user.ini file or apache configuration that will work with php-fpm?
That might avoid the path resolution issues.

Comment 4 Robert Bottomley 2019-07-05 01:26:23 UTC
I, too, had a working install that after an update keeps wanting me to set up LocalSettings.php. I just did a fresh install on a VM and it still doesn't work.

Comment 5 Patrick Uiterwijk 2019-07-08 08:12:15 UTC
So, I actually looked at this earlier, and you can set MW_INSTALL_PATH to fix this.
Example httpd config: https://infrastructure.fedoraproject.org/cgit/ansible.git/tree/roles/mediawiki/templates/mediawiki-app.conf.j2#n23 .

Comment 6 DaveG 2019-07-14 02:14:09 UTC
After some messing about I have a working wiki!
As suggested by the fedinfra ansible role I have changed my httpd mediawiki.conf to:

# Short URL support.
Alias "/wiki" "/document root/w/index.php"

<Directory "document root/w">
# Work around mediawiki symlink issues.
  SetEnv MW_INSTALL_PATH "document root/w"
    AllowOverride None
    Require all granted
</Directory>

# Upload directory.
<Directory " /document root/w/images">
  Options FollowSymLinks
  AllowOverride FileInfo
</Directory>

Adjust "document root" to suit.
Should still support multiple instances so long as MW_INSTALL_PATH is configured correctly in each (same as /etc/mediawiki/instances).

Tested with a PHP debug file to call phpinfo()...
MW_INSTALL_PATH shows up in the _$_SEVER environment and it looks like the mdiawiki code is happy with that.
No need to change the PHP-FPM pool configuration. Still works *without* clear_env = no.

Probably best to regenerate LocalSettings.php - skins have been dropped etc. since mediawiki-1.29.3, my last working setup.
Leaving my old one in place threw even more errors.
Delete or rename your LocalSettings.php and start a new installation; /mw-config/index.php...

Comment 7 Clay Jordan 2019-07-22 22:49:06 UTC
Following DaveG's response, my mediawiki.conf looks like:

<Directory /var/www/html/wiki/foo>
    SetEnv MW_INSTALL_PATH "/var/www/html/wiki/foo"
    AllowOverride None
    Require all granted
</Directory>

And it works for access but the mw-config/index.php script to upgrade the database still tries to look for LocalSettings.php in /usr/share/mediawiki. One can still fill out the forms and it will upgrade the db but the expected behavior is to discover the local setup and prompt to upgrade.

Steps to reproduce:
1. clear site cookies in test browser
2. access http://site/wiki/foo/mw-config/
3. choose language and you are prompted with steps for a new setup
4. copy LocalSettings.php to /usr/share/mediawiki
5. clear site cookies in test browser
6. access http://site/wiki/foo/mw-config/
7. choose language and you are promoted for the upgrade key

Comment 8 Clay Jordan 2019-07-23 02:17:02 UTC
fwiw, command line "fix" for above:

cd /usr/share/mediawiki/maintenance/; export MW_INSTALL_PATH=/var/www/html/wiki/foo; php update.php

Comment 9 Michael Cronenworth 2019-09-13 22:33:33 UTC
I'll update the examples and documentation to include the environment setting.


Note You need to log in before you can comment on or make changes to this bug.