0

I have a MediaWiki website; like any other MediaWiki website, it has a LocalSettings.php file.
If I navigate in a browser to:
https://example.com/LocalSettings.php
either when logged in as an admin or anonymously,
I get a blank page, almost like a WSOD. HTML source is also totally blank.

What makes MediaWiki's LocalSettings.php file blank (like a WSOD) in web browsers?

1

MediaWiki's LocalSetting.php file only stores settings that configure how MediaWiki works.

For example, a line might be:

$wgLogo        = "{$wgStylePath}/common/images/wiki.png";

All this does is make a variable $wgLogo available with a particular path as the string content. Then for example MediaWiki can refer to that image in its HTML section something like:

<img id="logo" src="<?php echo $wgLogo; ?>" title="logo:My Wiki Logo" />

Allowing display of the image referenced in that config setting.

So, the LocalSetting.php page doesn't display anything because it has no PHP code that creates HTML output. If you added the above tag to the end of the page (after the closing ?>), then it would probably work (though the page wouldn't be well formed HTML browsers will guess the necessary parts and fill them in creating a DOM structure to contain this malformed HTML).

You don't really want the page to show the settings as these give information that could possibly be used to compromise your site. In general you only want the web-server to be able to read your settings files, and don't want to leak those settings. However, a developer could make the page have a debug mode in which all the settings were written out and passed to the browser; but it's a big security risk.

0

Located in your localsettings.php file. The php code written below creates a blank localsettings.php in your web browser.

Protect against web entry

if ( !defined ( 'MEDIAWIKI' ) ) { exit; }

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.