Manual:LocalSettings.php
From Wiki Against Mines
back to Installation of Mediawiki Server and Environment
Contents |
LocalSettings.php
The file provides local configuration settings (based on the DefaultSettings.php file) of a MediaWiki installation. You should take your time to review the settings in this file. The file is usually generated by the web-based MediaWiki installer but you might want to tweak some of the parameters, possibly in concert with Apache settings. Changing a setting usually means changing the value of a PHP variable. You might want to make yourself familiar with the PHP syntax first before going ahead. As a rule of thumb, keep in mind that PHP variables are accessed by prepending a "$" character before the variable name; many variables are simply set to either true or false. Your changes will take effect immediately after saving the file: there is no need to manually "restart" anything. In some cases you may need to clear your browser's cache to see changes. The default values of many more settings are set in includes/DefaultSettings.php, which should not be edited; if the variable you want to change is not already mentioned in your LocalSettings.php, copy the appropriate line from DefaultSettings and modify it appropriately. Within LocalSettings.php you could add new lines at the end. All such lines should certainly appear below the line which says 'require_once( "includes/DefaultSettings.php" );' Within the file, there can also be several lines such as 'require_once( "extensions/extension.php" );', which link to other extensions enabled on the wiki. Those extensions may require setting the values of more variables in LocalSettings.php; check the extension's documentation for further instructions. A list of extensions is available at Extension Matrix.
Caution
Do not place extensions before the require_once( "includes/DefaultSettings.php" ); line; that will blank the extension setup function arrays, causing no extensions to be installed, and probably making your wiki inaccessible.
Your version of LocalSettings.php may not end with a closing PHP tag of ?>. This is done on purpose, as it prevents people from accidentally adding new information after this tag. PHP will function just fine without a closing tag.
See the configuration settings index and the comments included in the settings files for help on what all the variables do. A short listing of the most important variables, as well as the most requested features, is listed below.
If you have a wiki on a MediaWiki wiki farm you may not have write-access (perhaps not even read-access) to the file LocalSettings.php (see e.g.[1]). The wiki farm company may or may not be willing to make changes you desire. Perhaps it wants to keep most settings the same on all wikis of the wiki farm.
Standard settings
Include path
The $IP (include path) variable holds the local file path to the base installation of your wiki. Make sure you refer to the fully qualified file path. Do not include a slash at the end of the path. The DefaultSettings.php file gets loaded from the directory designated by the IP variable.
Site name
The $wgSitename variable holds the name of your wiki setup. This name gets included many times throughout the system. For instance, the Wikipedia tagline "'From Wikipedia, the free encyclopedia."' makes use of this setting.
Site language
The $wgLanguageCode variable controls the language of your wiki's interface. While users can switch the language they see in their preferences, this variable sets the default language that all anonymous users and most registered users see.
Script path
$wgScriptPath is the URL path prefix to access the main MediaWiki script that is the central acting piece of code of MediaWiki. This setting should correspond to the Apache settings, especially if you are using Apache's rewrite rules.
Server name
$wgServer can be used optionally to overwrite the automatic detection. When the wiki is accessed from either the localhost where it runs, from an intranet or from the internet, e-mail notifications and a few other computed messages would be usually delivered with the different URLs. Using $wgServer overwrites the detection and the server name will be constant. If www.domain.tld is the server address of your wiki as seen from the internet, add a line such as
$wgServer = 'http://www.domain.tld'; The magic word variable http://www.wiki-against-mines.org can be used on wiki pages; it equals the value of $wgServer .
Script name
$wgScript is the name of the main (index) MediaWiki PHP script, named index.php by default. Changing the script name is probably not a good idea. However, if you feel the urge to do so, this is the place to make your changes. Make sure you know what you are doing.
Redirect script name
The $wgRedirectScript variable specifies the URL path to the redirect script which handles redirects in MediaWiki. This setting is similar to wgScript as you can configure the exact name of the script. As mentioned above, this is probably not a good idea unless you really know what you are doing.
Stylesheet location
Use the $wgStylePath variable to set the URL path to the place where the stylesheets (CSS) for the MediaWiki installation are located. The $wgStyleDirectory variable should point the same place, but note that this is a local file system path for use in internal scripts accessing the file system.
Upload location
The upload directory is the place where files uploaded by the users are stored. The $wgUploadPath variable specifies the URL path, the $wgUploadDirectory points to the local file system path.
Logo
The $wgLogo variable specifies the relative URL pointing to the graphical logo that gets displayed on the top left corner by default. To replace the default logo in the /wiki/skins/common/images/ directory, add these to your LocalSettings.php file (below the "require" statements):
$wgStylePath = "/wiki/skins/";
$wgLogo = "{$wgStylePath}/common/images/wiki.png";
Instead, you might want to point the $wgStylePath variable to the Upload Directory to be able to exchange the logo by updating uploaded files. $wgStylePath is usually YOUR_WIKI_FOLDER/wiki/skins.
Contact info
The $wgEmergencyContact variable is the e-mail address of the user to contact when things happen. This e-mail address is used to send internal bug reports to. As an administrator, you want to include your e-mail address here. The $wgPasswordSender variable is the e-mail address where e-mail gets sent from, when passwords are sent out to users who have forgotten their passwords. Choose an address people can reply to in case of trouble or confusion.
References
- According to: Manual:LocalSettings.php (engl.)
Assessment
Please answer the following questions. For checking please klick the button “marking” In case of reaching less then four marks it is recommended to read the MediaWiki configuration paragraph, again.
continue with Configuration of MediaWiki
back to Installation of Mediawiki Server and Environment,,
