MediaWiki/LocalSettings.php: Unterschied zwischen den Versionen

Aus Foxwiki
Keine Bearbeitungszusammenfassung
Keine Bearbeitungszusammenfassung
 
(9 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 1: Zeile 1:
'''LocalSettings.php''' ist die Konfigurationsdatei für [[MediaWiki]]
'''LocalSettings.php''' ist die Konfigurationsdatei für [[MediaWiki]]


<languages/>
= TMP =
{{BOMWarning}}
The '''<code>LocalSettings.php</code>''' file provides basic [[Special:MyLanguage/Manual:Configuration settings|configuration settings]] of a [[Special:MyLanguage/MediaWiki|MediaWiki]] installation.
{{MW file|LocalSettings.php|NotInGit=<translate><!--T:103--> created during installation</translate>}}
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 can tweak the parameters, possibly in concert with Apache settings.
<translate><!--T:1--> The <tvar name=1>'''<code>LocalSettings.php</code>'''</tvar> file provides basic [[<tvar name=2>Special:MyLanguage/Manual:Configuration settings</tvar>|configuration settings]] of a [[<tvar name=4>Special:MyLanguage/MediaWiki</tvar>|MediaWiki]] installation.</translate>
For MediaWiki installations configured as a [[Special:MyLanguage/Manual:Wiki family|wiki farm]], a file named <code>[[Manual:CommonSettings.php|CommonSettings.php]]</code> may be used.
<translate><!--T:122--> You should take your time to review the settings in this file.</translate>
<translate><!--T:123--> The file is usually generated by the web-based MediaWiki installer but you can tweak the parameters, possibly in concert with Apache settings.</translate>
<translate><!--T:124--> For MediaWiki installations configured as a [[<tvar name=2>Special:MyLanguage/Manual:Wiki family</tvar>|wiki farm]], a file named <tvar name=1><code>{{ll|Manual:CommonSettings.php|CommonSettings.php}}</code></tvar> may be used.</translate>
 
<translate>
== Location on the server == <!--T:2-->
</translate>
<translate><!--T:3--> The <tvar name="1"><code>LocalSettings.php</code></tvar> file is not a wiki page, and you cannot access it with your web browser.</translate>
<!-- there were multiple(!) people assuming on the talk page that it _was_ a wiki page or at least web accessible -->
<translate><!--T:130--> Instead, it is a file in the file system of the server.</translate>
<translate><!--T:131--> Its contents are generated during the initial setup of the wiki, and the resulting file must be copied to the server manually.</translate>
<translate><!--T:132--> The file must be located in the folder you installed MediaWiki into, on the same level with folders like <tvar name="1"><code>includes/</code></tvar> and <tvar name="2"><code>skins/</code></tvar> and files like <tvar name="3"><code>api.php</code></tvar>.</translate>
<translate><!--T:133--> If this file is ''not'' there, the wiki will not work at all—if the wiki ''does'' work, the file ''is there''.</translate>
<translate><!--T:134--> If you do not know where it is, you can enter a command such as <kbd>find / -iname LocalSettings.php -print</kbd> in a terminal window to locate it.</translate>


<translate>
== Location on the server ==
<!--T:110-->
The <code>LocalSettings.php</code> file is not a wiki page, and you cannot access it with your web browser.
(If you are using Vagrant, see also [[<tvar name=vagrant>Special:MyLanguage/MediaWiki-Vagrant#mw-settings</tvar>|MediaWiki-Vagrant#MediaWiki_settings]].)


== Security == <!--T:4-->
Instead, it is a file in the file system of the server.
</translate>
Its contents are generated during the initial setup of the wiki, and the resulting file must be copied to the server manually.
<translate><!--T:5--> <tvar name="1"><code>LocalSettings.php</code></tvar> usually contains sensitive data such as database logins.</translate>
The file must be located in the folder you installed MediaWiki into, on the same level with folders like <code>includes/</code> and <code>skins/</code> and files like <code>api.php</code>.
<translate><!--T:135--> This data should ''never'' be revealed to the public!</translate>
If this file is ''not'' there, the wiki will not work at all—if the wiki ''does'' work, the file ''is there''.
<translate><!--T:136--> Due to a security breach somewhere on the server, it might happen that other users are able to view the contents of files.</translate>
If you do not know where it is, you can enter a command such as <kbd>find / -iname LocalSettings.php -print</kbd> in a terminal window to locate it.
<translate><!--T:137--> In order to improve security of your data, you should set UNIX permissions for this file accordingly: The webserver user must have access to this file.</translate>
<translate><!--T:138--> If this is the same account, who is the owner of the file, then you can set permissions to ''600''.</translate>
<translate><!--T:139--> Sometimes, the webserver user is ''not'' the file owner, but they are in the owner's UNIX user group.</translate>
<translate><!--T:140--> In this case, permissions of ''640'' should be fine. For improved security you should narrow permissions down as far as possible.</translate>


<translate>
(If you are using Vagrant, see also [[<tvar name=vagrant>Special:MyLanguage/MediaWiki-Vagrant#mw-settings|MediaWiki-Vagrant#MediaWiki_settings]].)
<!--T:6-->
Additionally, you can create a MySQL user, who is restricted to only the database used by the wiki and provide this user's credentials in <tvar name="1"><code>LocalSettings.php</code></tvar>. Also you can configure your database server to only accept connections from localhost - this should prevent access from outside in case of leaked credentials.


<!--T:146-->
== Security ==
See also <tvar name=1>{{ll|Manual:Securing database passwords}}</tvar> for a method to move the sensitive parts of <tvar name=2><code>LocalSettings.php</code></tvar> to a different file in a different directory.
<code>LocalSettings.php</code> usually contains sensitive data such as database logins.
This data should ''never'' be revealed to the public!
Due to a security breach somewhere on the server, it might happen that other users are able to view the contents of files.
In order to improve security of your data, you should set UNIX permissions for this file accordingly: The webserver user must have access to this file.
If this is the same account, who is the owner of the file, then you can set permissions to ''600''.
Sometimes, the webserver user is ''not'' the file owner, but they are in the owner's UNIX user group.
In this case, permissions of ''640'' should be fine. For improved security you should narrow permissions down as far as possible.


== File contents == <!--T:7-->
Additionally, you can create a MySQL user, who is restricted to only the database used by the wiki and provide this user's credentials in <code>LocalSettings.php</code>. Also you can configure your database server to only accept connections from localhost - this should prevent access from outside in case of leaked credentials.


<!--T:8-->
See also [[Manual:Securing database passwords]] for a method to move the sensitive parts of <code>LocalSettings.php</code> to a different file in a different directory.
When you edit <tvar name="1"><code>LocalSettings.php</code></tvar>, make sure to save it in the right encoding again. You should use "ANSI as UTF-8" encoding - that is UTF-8 encoding without byte order mark (BOM).


<!--T:9-->
== File contents ==
<tvar name="1"><code>LocalSettings.php</code></tvar> contains [[w:PHP|PHP code]]; mainly the definition of variables and their values. Changing a setting usually means changing the value of a PHP variable. Your changes will take effect immediately after saving the file again on the server: There is no need to manually "restart" anything. Anyway, in some cases you may need to clear your browser's cache to actually see the changes you made.
When you edit <code>LocalSettings.php</code>, make sure to save it in the right encoding again. You should use "ANSI as UTF-8" encoding - that is UTF-8 encoding without byte order mark (BOM).
</translate>


<translate><!--T:10--> The ''default'' values of many more settings are set in <tvar name="1"><code>includes/DefaultSettings.php</code></tvar>, ''which should not be edited;'' if the variable you want to change is not already mentioned in your <tvar name=2><code>LocalSettings.php</code></tvar>, copy the appropriate line from <tvar name="3"><code>DefaultSettings.php</code></tvar> and modify it appropriately in <tvar name=2><code>LocalSettings.php</code></tvar>.</translate>
<code>LocalSettings.php</code> contains [[w:PHP|PHP code]]; mainly the definition of variables and their values. Changing a setting usually means changing the value of a PHP variable. Your changes will take effect immediately after saving the file again on the server: There is no need to manually "restart" anything. Anyway, in some cases you may need to clear your browser's cache to actually see the changes you made.
'''<translate><!--T:157--> Within <tvar name="1"><code>LocalSettings.php</code></tvar> you can add new lines at the end.</translate>'''


<translate><!--T:11--> Within the file, there can also be several lines such as '<tvar name="1"><code>require_once "$IP/extensions/''extension''.php";</code></tvar>', which point to [[<tvar name=ext-content>Special:MyLanguage/Extension:Contents</tvar>|extensions]].</translate>
The ''default'' values of many more settings are set in <code>includes/DefaultSettings.php</code>, ''which should not be edited;'' if the variable you want to change is not already mentioned in your <code>LocalSettings.php</code>, copy the appropriate line from <code>DefaultSettings.php</code> and modify it appropriately in <code>LocalSettings.php</code>.
<translate><!--T:158--> These lines enable the according extension in the wiki.</translate>
''' Within <code>LocalSettings.php</code> you can add new lines at the end.'''
<translate><!--T:159--> Those extensions may require setting the values of more variables in <tvar name="1"><code>LocalSettings.php</code></tvar>; check the documentation of the according extension for further instructions.</translate>


<translate>
Within the file, there can also be several lines such as '<code>require_once "$IP/extensions/''extension''.php";</code>', which point to [[<tvar name=ext-content>Special:MyLanguage/Extension:Contents|extensions]].
<!--T:13-->
These lines enable the according extension in the wiki.
Like most PHP files in MediaWiki, <tvar name="1"><code>LocalSettings.php</code></tvar> does not end with the closing PHP tag <tvar name=code>{{phpi|?>}}</tvar>. This prevents admins from accidentally adding new information ''after'' this tag. PHP works fine without a closing tag.
Those extensions may require setting the values of more variables in <code>LocalSettings.php</code>; check the documentation of the according extension for further instructions.


<!--T:14-->
Like most PHP files in MediaWiki, <code>LocalSettings.php</code> does not end with the closing PHP tag. This prevents admins from accidentally adding new information ''after'' this tag. PHP works fine without a closing tag.
If you have a wiki on a MediaWiki [[w:wiki farm|wiki farm]] you may not have write-access (perhaps not even read-access) to the file <tvar name="1"><code>LocalSettings.php</code></tvar> (see e.g. <tvar name=wikiaforum>[http://community.wikia.com/wiki/Forum%3ALocalSettings.php%3F]</tvar>). 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.
</translate>


{{note|1=<translate><!--T:15--> This file is not written to your webserver automatically for security reasons. Instead, it is offered as a download, which you must then upload to your server for your wiki to begin working. For a more complete explanation, see [<tvar name=installer>//www.mediawiki.org/w/index.php?title=New-installer_issues&diff=334526&oldid=333913</tvar> this explanation].</translate>}}
If you have a wiki on a MediaWiki [[w:wiki farm|wiki farm]] you may not have write-access (perhaps not even read-access) to the file <code>LocalSettings.php</code> (see e.g. <tvar name=wikiaforum>[http://community.wikia.com/wiki/Forum%3ALocalSettings.php%3F]). 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.


<translate>
{{note|1= This file is not written to your webserver automatically for security reasons. Instead, it is offered as a download, which you must then upload to your server for your wiki to begin working. For a more complete explanation, see [<tvar name=installer>//www.mediawiki.org/w/index.php?title=New-installer_issues&diff=334526&oldid=333913 this explanation].]]
== Overview of available settings == <!--T:16-->


<!--T:17-->
== Overview of available settings ==
See the [[<tvar name=config>Special:MyLanguage/Manual:Configuration settings</tvar>|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.
See the [[<tvar name=config>Special:MyLanguage/Manual:Configuration settings|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.


==Standard settings== <!--T:18-->
==Standard settings==
===Install path===
The ''$IP'' (install path) variable holds the local file path to the base installation of your wiki.
Since MediaWiki 1.18, the system sets $IP automatically.
Setting {{phpi|$IP]] manually in <code>LocalSettings.php</code> is no longer needed.
{{phpi|$IP]] will default to the current working directory and can be used without the need to manually define it.
Attempting to set {{phpi|$IP]] (or <code>MW_INSTALL_PATH</code>) in <code>LocalSettings.php</code> may produce unexpected results.


===Install path=== <!--T:19-->
The [[Manual:DefaultSettings.php|DefaultSettings.php]] file gets loaded from the directory designated by the IP variable.
</translate>
<translate><!--T:20--> The <tvar name=1>'''{{ll|Manual:$IP|$IP}}'''</tvar> (install path) variable holds the local file path to the base installation of your wiki.</translate>
<translate><!--T:147--> Since MediaWiki 1.18, the system sets <tvar name=1>$IP</tvar> automatically.</translate>
<translate><!--T:148--> Setting <tvar name=1>{{phpi|$IP}}</tvar> manually in <tvar name=2><code>LocalSettings.php</code></tvar> is no longer needed.</translate>
<translate><!--T:149--> <tvar name=1>{{phpi|$IP}}</tvar> will default to the current working directory and can be used without the need to manually define it.</translate>
<translate><!--T:160--> Attempting to set <tvar name="1">{{phpi|$IP}}</tvar> (or <tvar name="2"><code>MW_INSTALL_PATH</code></tvar>) in <tvar name="3"><code>LocalSettings.php</code></tvar> may produce unexpected results.</translate>


<translate>
===Site name===
<!--T:21-->
''$wgSitename'' holds the name of your wiki setup. This name gets included many times throughout the system, such as via MediaWiki:Pagetitle. For instance, the Wikipedia tagline "From Wikipedia, the free encyclopedia" makes use of this setting.
The <tvar name=1>{{ll|Manual:DefaultSettings.php|DefaultSettings.php}}</tvar> file gets loaded from the directory designated by the IP variable.


===Site name=== <!--T:22-->
=== Declensions of site name ===
Some translations of interface are ready for inflection of site name.
You can set proper forms of word in variables ''$wgSitename'' documentation page).


<!--T:23-->
===Site language===
<tvar name=1>'''{{ll|Manual:$wgSitename|$wgSitename}}'''</tvar> holds the name of your wiki setup. This name gets included many times throughout the system, such as via MediaWiki:Pagetitle. For instance, the Wikipedia tagline "From Wikipedia, the free encyclopedia" makes use of this setting.
''$wgLanguageCode'' controls the language of your wiki's interface.
While users can switch the language they see in their [[Special:Preferences|preferences]], this variable sets the default language that all anonymous users and most registered users see.


=== Declensions of site name === <!--T:24-->
===Script path===
</translate>
''$wgScriptPath'' is the URL path prefix to access the main MediaWiki script that is the central acting piece of code of MediaWiki.
<translate><!--T:25--> Some translations of interface are ready for inflection of site name.</translate>
This setting should correspond to the [[Special:MyLanguage/Apache configuration|Apache settings]], especially if you are using Apache's [[w:Rewrite_engine|rewrite]] rules.
<translate><!--T:117--> You can set proper forms of word in variables <tvar name=1>'''{{ll|Manual:$wgGrammarForms|$wgGrammarForms}}'''</tvar> (for example please refer to the <tvar name=2>'''{{ll|Manual:$wgSitename|$wgSitename}}'''</tvar> documentation page).</translate>


<translate>
===Server name===
===Site language=== <!--T:26-->
''$wgServer'' contains the base URL of the server, including protocol but without the trailing slash and without the subdirectory if any. When the wiki is accessed from either the localhost where it runs, from an intranet or from the internet, email notifications and a few other computed messages would be usually delivered with the different URLs.
</translate>
<translate><!--T:27--> <tvar name=1>'''{{ll|Manual:$wgLanguageCode|$wgLanguageCode}}'''</tvar> controls the language of your wiki's interface.</translate>
<translate><!--T:125--> While users can switch the language they see in their [[<tvar name=1>Special:Preferences</tvar>|preferences]], this variable sets the default language that all anonymous users and most registered users see. </translate>


<translate>
From MediaWiki 1.34 {{phpi|$wgServer]] must be set in LocalSettings.php.
===Script path=== <!--T:28-->
Prior to that, MediaWiki tried to autodetect the name of the server and {{phpi|$wgServer]] was optional, to override the autodetection.
</translate>
<translate><!--T:29--> <tvar name=1>'''{{ll|Manual:$wgScriptPath|$wgScriptPath}}'''</tvar> is the URL path prefix to access the main MediaWiki script that is the central acting piece of code of MediaWiki.</translate>
<translate><!--T:116--> This setting should correspond to the [[<tvar name=1>Special:MyLanguage/Apache configuration</tvar>|Apache settings]], especially if you are using Apache's [[w:Rewrite_engine|rewrite]] rules.</translate>


<translate>
===Server name=== <!--T:30-->
<!--T:31-->
<tvar name=Server>'''{{ll|Manual:$wgServer|$wgServer}}'''</tvar> contains the base URL of the server, including protocol but without the trailing slash and without the subdirectory if any. When the wiki is accessed from either the localhost where it runs, from an intranet or from the internet, email notifications and a few other computed messages would be usually delivered with the different URLs.
</translate>
<translate><!--T:111--> From MediaWiki 1.34 <tvar name=1>{{phpi|$wgServer}}</tvar> must be set in <tvar name=2>LocalSettings.php</tvar>.</translate>
<translate><!--T:112--> Prior to that, MediaWiki tried to autodetect the name of the server and <tvar name=1>{{phpi|$wgServer}}</tvar> was optional, to override the autodetection.</translate>
<translate>
<!--T:32-->
If www.example.com is the server address of your wiki as seen from the internet, add a line such as
If www.example.com is the server address of your wiki as seen from the internet, add a line such as
</translate>


<syntaxhighlight lang="php">
<syntaxhighlight lang="php">
Zeile 129: Zeile 89:
</syntaxhighlight>
</syntaxhighlight>


<translate>
The [[m:Special:MyLanguage/Help:Magic words#Page names and related info|magic word]] variable <code><nowiki>{{SERVER]]</nowiki></code> can be used on wiki pages; it equals the value of {{phpi|$wgServer]]; however, on a wiki, such as those in the Wikimedia family, where relative urls are used, it will not fully expand, for example here it displays {{SERVER]], which can neither be clicked nor copy-pasted into the address bar as it is.
<!--T:33-->
The [[<tvar name=1>m:Special:MyLanguage/Help:Magic words#Page names and related info</tvar>|magic word]] variable <tvar name=2><code><nowiki>{{SERVER}}</nowiki></code></tvar> can be used on wiki pages; it equals the value of <tvar name=3>{{phpi|$wgServer}}</tvar>; however, on a wiki, such as those in the Wikimedia family, where relative urls are used, it will not fully expand, for example here it displays <tvar name=4>{{SERVER}}</tvar>, which can neither be clicked nor copy-pasted into the address bar as it is.
</translate>


<translate><!--T:154--> You can also use a protocol relative URL as shown below.</translate>
You can also use a protocol relative URL as shown below.
<translate><!--T:161--> When using a protocol relative URL, be sure to set <tvar name="1">{{phpi|$wgCanonicalServer}}</tvar>.</translate>
When using a protocol relative URL, be sure to set {{phpi|$wgCanonicalServer]].
<translate><!--T:162--> <tvar name="1">{{phpi|$wgCanonicalServer}}</tvar> is needed for some places in the code where an origin with a protocol and hostname is needed.</translate>
{{phpi|$wgCanonicalServer]] is needed for some places in the code where an origin with a protocol and hostname is needed.


<syntaxhighlight lang="php">
<syntaxhighlight lang="php">
Zeile 143: Zeile 100:
</syntaxhighlight>
</syntaxhighlight>


<translate>
===Script name===
===Script name=== <!--T:34-->
''$wgScript'' is the name of the main (index) MediaWiki PHP script, named <code>index.php</code> 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.


<!--T:35-->
===Article path===
<tvar name=Script>'''{{ll|Manual:$wgScript|$wgScript}}'''</tvar> is the name of the main (index) MediaWiki PHP script, named <tvar name="1"><code>index.php</code></tvar> 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.
''$wgArticlePath'' is the path to use when accessing a page in MediaWiki.
The path should contain the path to the main script (usually making use of {{phpi|$wgScript]]) and use the <code>$1</code> placeholder for the article name.


===Article path=== <!--T:38-->
If you are using Apache rewrite rules to create pretty and short URLs, you probably need to adjust {{phpi|$wgArticlePath]] to address the right path.
</translate>
Note that wgArticlePath is used to construct URLs from within MediaWiki.
<translate><!--T:39--> <tvar name=ArticlePath>'''{{ll|Manual:$wgArticlePath|$wgArticlePath}}'''</tvar> is the path to use when accessing a page in MediaWiki.</translate>
If you make a mistake here, internal links will show up incorrectly while you still may be able to access the main page by specifying the correct URL manually.
<translate><!--T:153--> The path should contain the path to the main script (usually making use of <tvar name=1>{{phpi|$wgScript}}</tvar>) and use the <tvar name=2><code>$1</code></tvar> placeholder for the article name.</translate>
See [[Manual:Short URL]] for more information on URL configuration.


<translate><!--T:40--> If you are using Apache rewrite rules to create pretty and short URLs, you probably need to adjust <tvar name=1>{{phpi|$wgArticlePath}}</tvar> to address the right path.</translate>
<translate><!--T:150--> Note that <tvar name=1>wgArticlePath</tvar> is used to construct URLs from within MediaWiki.</translate>
<translate><!--T:151--> If you make a mistake here, internal links will show up incorrectly while you still may be able to access the main page by specifying the correct URL manually.</translate>
<translate><!--T:152--> See <tvar name=1>{{ll|Manual:Short URL}}</tvar> for more information on URL configuration.</translate>
<translate>
<!--T:41-->
Typical values are:
Typical values are:
</translate>


{| class="wikitable"
{| class="wikitable"
| <code>"$wgScript/$1"</code>
| <code>"$wgScript/$1"</code>
| <translate><!--T:104--> pass the article name with separator "/"</translate>
| pass the article name with separator "/"
|-
|-
| <code>"$wgScript?title=$1"</code>
| <code>"$wgScript?title=$1"</code>
| <translate><!--T:105--> pass the article name as a parameter (old style)</translate>
| pass the article name as a parameter (old style)
|-
|-
| <code>"/mypath/$1"</code>
| <code>"/mypath/$1"</code>
| <translate><!--T:106--> custom path. Use Apache rewrite rules to convert "mypath" to the proper path accessing the main script</translate>
| custom path. Use Apache rewrite rules to convert "mypath" to the proper path accessing the main script
|}
|}


<translate>
===Stylesheet location===
===Stylesheet location=== <!--T:43-->
Use ''$wgStylePath'' to set the URL path to the place where the stylesheets (CSS) for the MediaWiki installation are located.
</translate>
''$wgStyleDirectory'' should point the same place, but note that this is a local file system path for use in internal scripts accessing the file system.
<translate><!--T:44--> Use <tvar name=1>'''{{ll|Manual:$wgStylePath|$wgStylePath}}'''</tvar> to set the URL path to the place where the stylesheets (CSS) for the MediaWiki installation are located.</translate>
<translate><!--T:126--> <tvar name=1>'''{{ll|Manual:$wgStyleDirectory|$wgStyleDirectory}}'''</tvar> should point the same place, but note that this is a local file system path for use in internal scripts accessing the file system.</translate>


<translate>
===Upload location===
===Upload location=== <!--T:45-->
The upload directory is the place where files uploaded by the users are stored. ''$wgUploadDirectory'' points to the local file system path.


<!--T:46-->
===Logo===
The upload directory is the place where files uploaded by the users are stored. <tvar name=1>'''{{ll|Manual:$wgUploadPath|$wgUploadPath}}'''</tvar> specifies the URL path, <tvar name=2>'''{{ll|Manual:$wgUploadDirectory|$wgUploadDirectory}}'''</tvar> points to the local file system path.
''$wgLogo'' specifies which graphical logo is displayed in the top left corner of all MediaWiki pages. These steps replace the default logo in the /wiki/skins/common/images/ directory, replacing /wiki with the path to the directory where you installed the MediaWiki software.


===Logo=== <!--T:47-->
<!--T:48-->
<tvar name=Logo>'''{{ll|Manual:$wgLogo|$wgLogo}}'''</tvar> specifies which graphical logo is displayed in the top left corner of all MediaWiki pages. These steps replace the default logo in the /wiki/skins/common/images/ directory, replacing /wiki with the path to the directory where you installed the MediaWiki software.
<!--T:49-->
First, copy whatever logo you want into the /wiki/skins/common/images/ directory (replacing /wiki with the path to the directory where you installed the MediaWiki software).
First, copy whatever logo you want into the /wiki/skins/common/images/ directory (replacing /wiki with the path to the directory where you installed the MediaWiki software).


<!--T:50-->
Next, try to find the line that looks like this in <code>LocalSettings.php</code>:
Next, try to find the line that looks like this in <tvar name="1"><code>LocalSettings.php</code></tvar>:
</translate>


<syntaxhighlight lang="php" style="overflow:auto;">
<syntaxhighlight lang="php" style="overflow:auto;">
Zeile 203: Zeile 143:
</syntaxhighlight>
</syntaxhighlight>


<translate>
<!--T:51-->
If there's no such line, you can copy and paste the line above at the end of the file.
If there's no such line, you can copy and paste the line above at the end of the file.


<!--T:52-->
Then, modify that line to point to your logo. The logo must be web accessible. The value of this variable is passed to the web browser, which uses it to fetch the logo. If in doubt, a good way to pick what to put here is navigate to the logo in your web browser (for example, this wiki the url of the logo is http://upload.wikimedia.org/wikipedia/mediawiki/b/bc/Wiki.png ), and put the full URL as the value of this variable.
Then, modify that line to point to your logo. The logo must be web accessible. The value of this variable is passed to the web browser, which uses it to fetch the logo. If in doubt, a good way to pick what to put here is navigate to the logo in your web browser (for example, this wiki the url of the logo is http://upload.wikimedia.org/wikipedia/mediawiki/b/bc/Wiki.png ), and put the full URL as the value of this variable.


<!--T:53-->
Some people just replace the skins/common/images/wiki.png file with their logo. This is not recommended, as the customized logo would be overwritten on upgrade.
Some people just replace the skins/common/images/wiki.png file with their logo. This is not recommended, as the customized logo would be overwritten on upgrade.
</translate>


<translate><!--T:156--> MediaWiki 1.35 introduced <tvar name=1>{{ll|Manual:$wgLogos|$wgLogos}}</tvar>, which allows multiple versions of the same logo.</translate>
MediaWiki 1.35 introduced [[Manual:$wgLogos|$wgLogos]], which allows multiple versions of the same logo.
<translate><!--T:155--> An example of using multiple logos is shown below.</translate>
An example of using multiple logos is shown below.


<syntaxhighlight lang="php" style="overflow:auto;">
<syntaxhighlight lang="php" style="overflow:auto;">
$wgLogos = [
$wgLogos = [
'1x' => "$wgStylePath/common/images/1x_version.png",
'1x' => "$wgStylePath/common/images/1x_version.png",
'1.5x' => "$wgStylePath/common/1.5x_version.png",
'1.5x' => "$wgStylePath/common/1.5x_version.png",
...
...
'tagline' => [
'tagline' => [
'src' => "$wgStylePath/common/tagline_version.png",
'src' => "$wgStylePath/common/tagline_version.png",
'width' => 135,
'width' => 135,
'height' => 15,
'height' => 15,
],
],
];
];
</syntaxhighlight>
</syntaxhighlight>


<translate>
===Contact info===
===Contact info=== <!--T:54-->
''$wgEmergencyContact'' is the email address of the user to contact if something goes wrong. This email address is used to send internal bug reports to. As an administrator, you want to include your email address here.
 
<!--T:55-->
<tvar name=EmergencyContact>'''{{ll|Manual:$wgEmergencyContact|$wgEmergencyContact}}'''</tvar> is the email address of the user to contact if something goes wrong. This email address is used to send internal bug reports to. As an administrator, you want to include your email address here.
 
<!--T:56-->
<tvar name=PasswordSender>'''{{ll|Manual:$wgPasswordSender|$wgPasswordSender}}'''</tvar> is the email address where email 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.


===Database settings=== <!--T:57-->
''$wgPasswordSender'' is the email address where email 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.


<!--T:58-->
===Database settings===
MediaWiki needs access to the database (currently either [[w:MySQL|MySQL]] or [[w:PostgreSQL|PostgreSQL]]) to store pages, modifications, user information, and a lot more things.
MediaWiki needs access to the database (currently either [[w:MySQL|MySQL]] or [[w:PostgreSQL|PostgreSQL]]) to store pages, modifications, user information, and a lot more things.


<!--T:59-->
''$wgDBserver'' contains the hostname where the database is hosted on. In most cases this will be just "localhost" as the database is run on the same system, but for distributed installations, you need to fill in the fully qualified domain name of the computer running the database.
<tvar name=DBserver>'''{{ll|Manual:$wgDBserver|$wgDBserver}}'''</tvar> contains the hostname where the database is hosted on. In most cases this will be just "localhost" as the database is run on the same system, but for distributed installations, you need to fill in the fully qualified domain name of the computer running the database.
 
<!--T:60-->
<tvar name=DBname>'''{{ll|Manual:$wgDBname|$wgDBname}}'''</tvar> is the ''database name'' of the database to be used by MediaWiki. A single MySQL or PostgreSQL installation can store more than one database and you can even run many MediaWiki installations on a single server. Make sure you have stated the correct database name here and use different database names for different wiki installations on the same database server.
 
<!--T:61-->
<tvar name=DBuser>'''{{ll|Manual:$wgDBuser|$wgDBuser}}'''</tvar> and <tvar name=DBpassword>'''{{ll|Manual:$wgDBpassword|$wgDBpassword}}'''</tvar> contain the login name and password to be used by MediaWiki to access the database. Make sure the specified user has the proper access rights to be able to manipulate the wiki's table on the database server.
</translate>


<translate><!--T:163--> Also see <tvar name="1">{{ll|Manual:Securing database passwords}}</tvar> for a method to move the sensitive parts of <tvar name="2"><code>LocalSettings.php</code></tvar> to a different file in a different directory.</translate>
''$wgDBname'' is the ''database name'' of the database to be used by MediaWiki. A single MySQL or PostgreSQL installation can store more than one database and you can even run many MediaWiki installations on a single server. Make sure you have stated the correct database name here and use different database names for different wiki installations on the same database server.


<translate>
''$wgDBpassword'' contain the login name and password to be used by MediaWiki to access the database. Make sure the specified user has the proper access rights to be able to manipulate the wiki's table on the database server.
===User rights=== <!--T:62-->


<!--T:63-->
Also see [[Manual:Securing database passwords]] for a method to move the sensitive parts of <code>LocalSettings.php</code> to a different file in a different directory.
<tvar name=GroupPermissions>'''{{ll|Manual:$wgGroupPermissions|$wgGroupPermissions}}'''</tvar> is an associative array, controlling permissions for creating and editing pages for your different user groups. In this array, custom permission levels can be created, and permission levels for the different user groups can be set. See <tvar name=1>{{ll|Help:User rights}}</tvar> for more information about the different permissions and user groups available.


===Force capital links=== <!--T:64-->
===User rights===
''$wgGroupPermissions'' is an associative array, controlling permissions for creating and editing pages for your different user groups. In this array, custom permission levels can be created, and permission levels for the different user groups can be set. See [[Help:User rights]] for more information about the different permissions and user groups available.


<!--T:65-->
===Force capital links===
By default, no page name can start with a lowercase [[w:Latin alphabet|Roman letter]]: in an attempt to do so the first letter is converted to uppercase; if a link target, included page, image or category is specified with a name starting with a lowercase letter, the actual target etc. is the page starting with the corresponding capital.
By default, no page name can start with a lowercase [[w:Latin alphabet|Roman letter]]: in an attempt to do so the first letter is converted to uppercase; if a link target, included page, image or category is specified with a name starting with a lowercase letter, the actual target etc. is the page starting with the corresponding capital.


<!--T:66-->
Alternatively page names ''can'' start with a lowercase letter, in addition to the possibilities of starting with a capital, a digit, etc. For that you must adjust ''$wgCapitalLinks''. Setting it to '''false''' allows lowercase characters, '''true''' chooses the default behavior.
Alternatively page names ''can'' start with a lowercase letter, in addition to the possibilities of starting with a capital, a digit, etc. For that you must adjust <tvar name=CapitalLinks>'''{{ll|Manual:$wgCapitalLinks|$wgCapitalLinks}}'''</tvar>. Setting it to '''false''' allows lowercase characters, '''true''' chooses the default behavior.
 
===Enabling subpages=== <!--T:67-->


<!--T:68-->
===Enabling subpages===
In <tvar name="1"><code>LocalSettings.php</code></tvar>, [[<tvar name=subpg>Special:MyLanguage/Help:Subpages</tvar>|subpages]] are enabled on a per-namespace basis using <tvar name=NamespacesWithSubpages>'''{{ll|Manual:$wgNamespacesWithSubpages|$wgNamespacesWithSubpages}}'''</tvar>. For example, to enable subpages in the main namespace:
In <code>LocalSettings.php</code>, [[''$wgNamespacesWithSubpages''. For example, to enable subpages in the main namespace:
</translate>


<syntaxhighlight lang="php">
<syntaxhighlight lang="php">
Zeile 280: Zeile 196:
</syntaxhighlight>
</syntaxhighlight>


<translate>
===Image uploads===
===Image uploads=== <!--T:69-->
Before users are allowed to upload files to the MediaWiki system, you have to enable that feature. Make sure the Upload Directory is properly configured and writeable by the Apache web server process. Then set ''$wgEnableUploads'' to '''true''' to allow uploading in the web user interface.
 
<!--T:70-->
Before users are allowed to upload files to the MediaWiki system, you have to enable that feature. Make sure the Upload Directory is properly configured and writeable by the Apache web server process. Then set <tvar name=EnableUploads>'''{{ll|Manual:$wgEnableUploads|$wgEnableUploads}}'''</tvar> to '''true''' to allow uploading in the web user interface.


<!--T:71-->
i.e. Here's some example code from ''includes/DefaultSettings.php'' to put in <code>LocalSettings.php</code>:
i.e. Here's some example code from ''includes/DefaultSettings.php'' to put in <tvar name="1"><code>LocalSettings.php</code></tvar>:
</translate>


<syntaxhighlight lang="php" style="overflow:auto;">
<syntaxhighlight lang="php" style="overflow:auto;">
$wgUploadPath       = "$wgScriptPath/uploads";     ## Wiki 1.5 defaults to /images, but allows more than just images
$wgUploadPath = "$wgScriptPath/uploads"; ## Wiki 1.5 defaults to /images, but allows more than just images
$wgUploadDirectory = "$IP/uploads";               ## Wiki 1.5 defaults to /images, but allows more than just images
$wgUploadDirectory = "$IP/uploads"; ## Wiki 1.5 defaults to /images, but allows more than just images


## To enable image uploads, make sure the above '$wgUploadPath' directory is writable by Apache User or group.
## To enable image uploads, make sure the above '$wgUploadPath' directory is writable by Apache User or group.
## ''(i.e. chmod og+w uploads images)'' then the following should be true:
## ''(i.e. chmod og+w uploads images)'' then the following should be true:
$wgEnableUploads       = true;
$wgEnableUploads = true;
 
$wgUseImageMagick = true;
$wgUseImageMagick     = true;
$wgImageMagickConvertCommand = "/usr/bin/convert";
$wgImageMagickConvertCommand = "/usr/bin/convert";


Zeile 306: Zeile 216:
</syntaxhighlight>
</syntaxhighlight>


<translate><!--T:72--> If you want to be able to resize images on the fly to support thumbnails, MediaWiki needs a working [[w:ImageMagick|ImageMagick]] installation.</translate>
If you want to be able to resize images on the fly to support thumbnails, MediaWiki needs a working [[w:ImageMagick|ImageMagick]] installation.
<translate><!--T:127--> Set <tvar name=1>'''{{ll|Manual:$wgUseImageMagick|$wgUseImageMagick}}'''</tvar> to '''true''' once you have installed and tested ImageMagick on your system.</translate>
Set ''$wgUseImageMagick'' to '''true''' once you have installed and tested ImageMagick on your system.
<translate><!--T:128--> Make sure <tvar name=1>'''{{ll|Manual:$wgImageMagickConvertCommand|$wgImageMagickConvertCommand}}'''</tvar> points to the proper location of the <tvar name=2><code>convert</code></tvar> command of your installation, that the command is executable by the web server process, and <tvar name=3>'''{{ll|Manual:$wgMaxShellMemory|$wgMaxShellMemory}}'''</tvar> is large enough.</translate>
Make sure ''$wgMaxShellMemory'' is large enough.
<translate><!--T:129--> See {{<tvar name=1>ll|Manual:Image administration#Image thumbnailing</tvar>|Manual:Image administration#Image thumbnailing}} for detailed information and troubleshooting.</translate>
See [[Manual:Image administration#Image thumbnailing|Manual:Image administration#Image thumbnailing]] for detailed information and troubleshooting.


<translate>
Also, you may want to modify the list of accepted extensions, which is stored within ''$wgFileExtensions'':
<!--T:73-->
Also, you may want to modify the list of accepted extensions, which is stored within <tvar name=1>'''{{ll|Manual:$wgFileExtensions|$wgFileExtensions}}'''</tvar>:
</translate>


<syntaxhighlight lang="php">
<syntaxhighlight lang="php">
Zeile 320: Zeile 227:
</syntaxhighlight>
</syntaxhighlight>


<translate>
<!--T:74-->
In case ImageMagick outputs an error message similar to the following:
In case ImageMagick outputs an error message similar to the following:
</translate>


<blockquote>
<blockquote>
<translate><!--T:164--> Fatal error: mime_magic could not be initialized, magic file is not available in includes/MimeMagic.php on line 506</translate>
Fatal error: mime_magic could not be initialized, magic file is not available in includes/MimeMagic.php on line 506
</blockquote>
</blockquote>


<translate>
then try adding the following line to <code>LocalSettings.php</code>:
<!--T:75-->
then try adding the following line to <tvar name="1"><code>LocalSettings.php</code></tvar>:
</translate>


<code class="mw-code mw-highlight" style="display:block"><!--
<code class="mw-code mw-highlight" style="display:block"><!--
-->{{ll|Manual:$wgMimeDetectorCommand|$wgMimeDetectorCommand}} = {{#tag:span|"file -bi"|class=s2}};
-->[[Manual:$wgMimeDetectorCommand|$wgMimeDetectorCommand]] = {{#tag:span|"file -bi"|class=s2]];
</code>
</code>


{{note|1=<translate><!--T:76--> Read the [[<tvar name=1>Special:MyLanguage/Manual:Security#Upload security</tvar>|upload security]] section in the [[<tvar name=1>Special:MyLanguage/Manual:Security#Upload security</tvar>|Manual:Security]].</translate><br />
{{note|1= Read the [[Special:MyLanguage/Manual:Security#Upload security|upload security]] section in the [[Special:MyLanguage/Manual:Security#Upload security|Manual:Security]].<br />
<translate>
 
<!--T:109-->
Further information is available in:
Further information is available in:
</translate>
* {{ll|Manual:Configuring file uploads}}
* {{ll|Manual:MIME type detection}}
* {{ll|Manual:Image administration#Image thumbnailing|2=<translate><!--T:144--> Manual:Image administration#Image thumbnailing</translate>}}
<!-- should be synced or merged! -->
}}


<translate>
* [[Manual:Configuring file uploads]]
===Interwiki support=== <!--T:79-->
* [[Manual:MIME type detection]]
</translate>
* [[Manual:Image administration#Image thumbnailing|2= Manual:Image administration#Image thumbnailing]]
<translate><!--T:80--> InterWiki support is built into MediaWiki but you need to configure the prefix to be used for your internal links.</translate>
<translate><!--T:118--> This prefix is usually the same as <tvar name=1>{{wg|Sitename}}</tvar>, but in case you need to change that, you set the <tvar name=2>{{wg|LocalInterwikis}}</tvar> variable to the preferred name.</translate>


<translate>
]]


===Language of user interface=== <!--T:81-->
===Interwiki support===
InterWiki support is built into MediaWiki but you need to configure the prefix to be used for your internal links.
This prefix is usually the same as {{wg|Sitename]], but in case you need to change that, you set the {{wg|LocalInterwikis]] variable to the preferred name.


<!--T:82-->
===Language of user interface===
MediaWiki allows for a variety of localized user interfaces languages instead of the English default. If you want to run your wiki in a non-English language, set the <tvar name=LanguageCode>{{wg|LanguageCode}}</tvar> variable to the proper [[<tvar name="1">Special:SiteMatrix</tvar>|language code]] (e.g. "de" for German, "es" for Spanish, etc.)
MediaWiki allows for a variety of localized user interfaces languages instead of the English default. If you want to run your wiki in a non-English language, set the variable to the proper [[Special:SiteMatrix|language code]] (e.g. "de" for German, "es" for Spanish, etc.)


<!--T:83-->
You may use any of the languages with a file in the directory {{git file |file=languages/i18n]]. E.g. if you find <code>es.json</code>, then you can use <code>"es"</code> for Spanish. Do not use <code>"Es"</code> with a capital letter. Although it seems to work, not all texts are translated.
You may use any of the languages with a file in the directory <tvar name="1">{{git file |file=languages/i18n}}</tvar>. E.g. if you find <tvar name="2"><code>es.json</code></tvar>, then you can use <tvar name="3"><code>"es"</code></tvar> for Spanish. Do not use <tvar name="4"><code>"Es"</code></tvar> with a capital letter. Although it seems to work, not all texts are translated.
</translate>


{{note|1=<translate><!--T:84--> After changing the language code, you will need to run a PHP script to make it work.</translate> <translate><!--T:113--> In a terminal window, change to your wiki directory, change to the <tvar name="1"><code>maintenance</code></tvar> folder, and enter <syntaxhighlight lang=bash inline>php rebuildMessages.php --rebuild</syntaxhighlight>.</translate> <translate><!--T:114--> On Windows, the PHP folder might not be in your <tvar name="1"><code>PATH</code></tvar> environment variable and you'll have to prefix <kbd>php</kbd> with the path to the program.</translate>}}
{{note|1= After changing the language code, you will need to run a PHP script to make it work. In a terminal window, change to your wiki directory, change to the <code>maintenance</code> folder, and enter <syntaxhighlight lang=bash inline>php rebuildMessages.php --rebuild</syntaxhighlight>. On Windows, the PHP folder might not be in your <code>PATH</code> environment variable and you'll have to prefix <kbd>php</kbd> with the path to the program.]]


<translate><!--T:85--> Not all languages are supported.</translate>
Not all languages are supported.
<translate><!--T:166--> See the [<tvar name=url>https://translatewiki.net/w/i.php?title=Special:MessageGroupStats&group=mediawiki</tvar> translation statistics on TranslateWiki] for an up-to-date list of which languages are supported and to what extent.</translate>
See the [<tvar name=url>https://translatewiki.net/w/i.php?title=Special:MessageGroupStats&group=mediawiki translation statistics on TranslateWiki] for an up-to-date list of which languages are supported and to what extent.
<translate><!--T:167--> That list reflects the current state of MediaWiki core, so depending on what version you are using there may be a discrepancy.</translate>
That list reflects the current state of MediaWiki core, so depending on what version you are using there may be a discrepancy.


<translate>
===Setting copyright for the site===
===Setting copyright for the site=== <!--T:86-->
* ''$wgRightsPage'' is the page on the wiki that covers the copyrights that it falls under. Usually, this will be [[Project:Copyrights]].


<!--T:87-->
* ''$wgRightsUrl'' is the page describing full details of your license. (For the GNU FDL, for example, this would be <code>http://www.gnu.org/licenses/fdl.html</code>.)
* <tvar name=RightsPage>'''{{ll|Manual:$wgRightsPage|$wgRightsPage}}'''</tvar> is the page on the wiki that covers the copyrights that it falls under. Usually, this will be <tvar name="1">{{ll|Project:Copyrights}}</tvar>.</translate>
<translate>
<!--T:141-->
* <tvar name=RightsUrl>'''{{ll|Manual:$wgRightsUrl|$wgRightsUrl}}'''</tvar> is the page describing full details of your license. (For the GNU FDL, for example, this would be <tvar name="1"><code>http://www.gnu.org/licenses/fdl.html</code></tvar>.) </translate>
<translate>
<!--T:142-->
* <tvar name=RightsText>'''{{ll|Manual:$wgRightsText|$wgRightsText}}'''</tvar> is the text in the footer that follows "Content is available under". It will be linked to the page specified in <tvar name="1"><code>$wgRightsPage</code></tvar>.</translate>
<translate>
<!--T:143-->
* <tvar name=RightsIcon>'''{{ll|Manual:$wgRightsIcon|$wgRightsIcon}}'''</tvar> is the URL of the image placed at the left of the footer.
</translate>


{{note|1=<translate><!--T:115--> If <tvar name="1"><code>$wgRightsPage</code></tvar> is non-empty, the link in the copyright/license notice will link to that page on your site. If <tvar name=1><code>$wgRightsPage</code></tvar> is empty then the copyright/license notice will link to <tvar name="3"><code>$wgRightsUrl</code></tvar> instead.</translate>}}
* ''$wgRightsText'' is the text in the footer that follows "Content is available under". It will be linked to the page specified in <code>$wgRightsPage</code>.


<translate>
* ''$wgRightsIcon'' is the URL of the image placed at the left of the footer.
<!--T:88-->
 
To modify the copyright statements of the site, add something like this to <tvar name="1"><code>LocalSettings.php</code></tvar>:
{{note|1= If <code>$wgRightsPage</code> is non-empty, the link in the copyright/license notice will link to that page on your site. If <code>$wgRightsPage</code> is empty then the copyright/license notice will link to <code>$wgRightsUrl</code> instead.]]
</translate>
 
To modify the copyright statements of the site, add something like this to <code>LocalSettings.php</code>:


<syntaxhighlight lang="php" style="overflow:auto;">
<syntaxhighlight lang="php" style="overflow:auto;">
Zeile 400: Zeile 282:
</syntaxhighlight>
</syntaxhighlight>


<translate>
Afterwards, edit [[MediaWiki:Copyright]] to provide an appropriate message, using <code>"$1"</code> to indicate the position where the link to your copyright page will be.
<!--T:89-->
Afterwards, edit [[MediaWiki:Copyright]] to provide an appropriate message, using <tvar name="1"><code>"$1"</code></tvar> to indicate the position where the link to your copyright page will be.


<!--T:90-->
'''Example: setting a [[w:Creative Commons|Creative Commons]] license'''
'''Example: setting a [[w:Creative Commons|Creative Commons]] license'''


<!--T:91-->
To set a Creative Commons license do the following:
To set a Creative Commons license do the following:


<!--T:92-->
* Choose your license: <tvar name=url>http://creativecommons.org/choose/
* Choose your license: <tvar name=url>http://creativecommons.org/choose/</tvar></translate>
* Examine the returned HTML code, e.g.:
* <translate><!--T:165--> Examine the returned HTML code, e.g.:</translate>


<syntaxhighlight lang="html4strict" style="overflow:auto;">
<syntaxhighlight lang="html4strict" style="overflow:auto;">
Zeile 423: Zeile 300:
</syntaxhighlight>
</syntaxhighlight>


<translate>
* For <code>$wgRightsURL</code> enter the href info from the first anchor:
<!--T:93-->
 
* For <tvar name="1"><code>$wgRightsURL</code></tvar> enter the href info from the first anchor:
</translate>
<syntaxhighlight lang="php" style="overflow:auto;">$wgRightsUrl = "http://creativecommons.org/licenses/by-nc-sa/3.0/";</syntaxhighlight>
<syntaxhighlight lang="php" style="overflow:auto;">$wgRightsUrl = "http://creativecommons.org/licenses/by-nc-sa/3.0/";</syntaxhighlight>
<translate>
 
<!--T:94-->
* For <code>$wgRightsText</code> enter the text the second anchor links from (add the "a" to the Wiki variable for a more grammatically correct version)
* For <tvar name="1"><code>$wgRightsText</code></tvar> enter the text the second anchor links from (add the "a" to the Wiki variable for a more grammatically correct version)
 
</translate>
<syntaxhighlight lang="php" style="overflow:auto;">$wgRightsText = "a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License";</syntaxhighlight>
<syntaxhighlight lang="php" style="overflow:auto;">$wgRightsText = "a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License";</syntaxhighlight>
<translate>
 
<!--T:95-->
* For <code>$wgRightsIcon</code> enter the src info from the img link in the first anchor. You want to copy the badge to your own site instead of using the one from the Creative Commons site.
* For <tvar name="1"><code>$wgRightsIcon</code></tvar> enter the src info from the img link in the first anchor. You want to copy the badge to your own site instead of using the one from the Creative Commons site.
 
</translate>
<syntaxhighlight lang="php" style="overflow:auto;">$wgRightsIcon = "http://creativecommons.org/images/public/somerights30.png";</syntaxhighlight>
<syntaxhighlight lang="php" style="overflow:auto;">$wgRightsIcon = "http://creativecommons.org/images/public/somerights30.png";</syntaxhighlight>
<translate>
 
<!--T:96-->
* For using [[w:Resource Description Framework|RDF metadata]] about copyright add one or both of the following lines to your <code>LocalSettings.php</code>:
* For using [[w:Resource Description Framework|RDF metadata]] about copyright add one or both of the following lines to your <tvar name="1"><code>LocalSettings.php</code></tvar>:
</translate>


<syntaxhighlight lang="php" style="overflow:auto;">
<syntaxhighlight lang="php" style="overflow:auto;">
Zeile 448: Zeile 319:
</syntaxhighlight>
</syntaxhighlight>


<translate>
===Custom namespaces===
By declaring ''$wgNamespaceAliases'' array namespace aliases can be added.
'''Take heed''' not to have any pages already titled in that namespace, for instance if you had a page called "Technical:Support" and you created the Technical: namespace, then that page would not only be lost, but you cannot remove it from Special:Allpages.
To fix this delete the namespace, move "Technical:Support" to "Support" in mainspace, delete the redirect, reinsert the namespace, and move it back to "Technical:Support".
See [[Manual:Using custom namespaces|Custom namespaces]] for more information as to how to do so.


===Custom namespaces=== <!--T:97-->
The default skin of the site can be modified via ''$wgDefaultSkin''.
</translate>
<translate><!--T:98--> By declaring <tvar name=1>'''{{ll|Manual:$wgExtraNamespaces|$wgExtraNamespaces}}'''</tvar>, and modifying <tvar name=2>'''{{ll|Manual:$wgNamespacesWithSubpages|$wgNamespacesWithSubpages}}'''</tvar>, and <tvar name=3>'''{{ll|Manual:$wgNamespacesToBeSearchedDefault|$wgNamespacesToBeSearchedDefault}}'''</tvar>, extra namespaces can be added to a MediaWiki installation; and by declaring the <tvar name=4>'''{{ll|Manual:$wgNamespaceAliases|$wgNamespaceAliases}}'''</tvar> array namespace aliases can be added.</translate>
<translate><!--T:119--> '''Take heed''' not to have any pages already titled in that namespace, for instance if you had a page called "Technical:Support" and you created the Technical: namespace, then that page would not only be lost, but you cannot remove it from Special:Allpages.</translate>
<translate><!--T:120--> To fix this delete the namespace, move "Technical:Support" to "Support" in mainspace, delete the redirect, reinsert the namespace, and move it back to "Technical:Support".</translate>
<translate><!--T:121--> See {{<tvar name=1>ll|Manual:Using custom namespaces</tvar>|Custom namespaces}} for more information as to how to do so.</translate>


The default skin of the site can be modified via <tvar name=DefaultSkin>'''{{ll|Manual:$wgDefaultSkin|$wgDefaultSkin}}'''</tvar>.
==See also==
* {{file doclink |LocalSettingsGenerator]] source code, which generates the inital contents of <code>LocalSettings.php</code> during installation.


==See also== <!--T:101-->
*[[<tvar name=wfamily>Special:MyLanguage/Manual:Wiki family|Wiki families]] can share the same {{BASEPAGENAME]].
</translate>
* {{file doclink |LocalSettingsGenerator}} <translate><!--T:107--> source code, which generates the inital contents of <tvar name="1"><code>LocalSettings.php</code></tvar> during installation.</translate>
<translate>
<!--T:102-->
*[[<tvar name=wfamily>Special:MyLanguage/Manual:Wiki family</tvar>|Wiki families]] can share the same {{BASEPAGENAME}}.
</translate>
*{{ll|Manual:Securing database passwords}} - <translate><!--T:145--> a guide to securing your database passwords and <tvar name=1><code>LocalSettings.php</code></tvar> file.</translate>


[[Category:MediaWiki configuration{{#translation:}}| ]]
*[[Manual:Securing database passwords]] - a guide to securing your database passwords and <code>LocalSettings.php</code> file.


[[Category:MediaWiki configuration{{#translation:]]| ]]


= TMP =
= TMP =
Zeile 478: Zeile 343:


; /mw-config/
; /mw-config/


== Links ==
== Links ==

Aktuelle Version vom 4. Juni 2024, 08:07 Uhr

LocalSettings.php ist die Konfigurationsdatei für MediaWiki

TMP

The LocalSettings.php file provides basic configuration settings 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 can tweak the parameters, possibly in concert with Apache settings. For MediaWiki installations configured as a wiki farm, a file named CommonSettings.php may be used.

Location on the server

The LocalSettings.php file is not a wiki page, and you cannot access it with your web browser.

Instead, it is a file in the file system of the server. Its contents are generated during the initial setup of the wiki, and the resulting file must be copied to the server manually. The file must be located in the folder you installed MediaWiki into, on the same level with folders like includes/ and skins/ and files like api.php. If this file is not there, the wiki will not work at all—if the wiki does work, the file is there. If you do not know where it is, you can enter a command such as find / -iname LocalSettings.php -print in a terminal window to locate it.

(If you are using Vagrant, see also [[<tvar name=vagrant>Special:MyLanguage/MediaWiki-Vagrant#mw-settings|MediaWiki-Vagrant#MediaWiki_settings]].)

Security

LocalSettings.php usually contains sensitive data such as database logins. This data should never be revealed to the public! Due to a security breach somewhere on the server, it might happen that other users are able to view the contents of files. In order to improve security of your data, you should set UNIX permissions for this file accordingly: The webserver user must have access to this file. If this is the same account, who is the owner of the file, then you can set permissions to 600. Sometimes, the webserver user is not the file owner, but they are in the owner's UNIX user group. In this case, permissions of 640 should be fine. For improved security you should narrow permissions down as far as possible.

Additionally, you can create a MySQL user, who is restricted to only the database used by the wiki and provide this user's credentials in LocalSettings.php. Also you can configure your database server to only accept connections from localhost - this should prevent access from outside in case of leaked credentials.

See also Manual:Securing database passwords for a method to move the sensitive parts of LocalSettings.php to a different file in a different directory.

File contents

When you edit LocalSettings.php, make sure to save it in the right encoding again. You should use "ANSI as UTF-8" encoding - that is UTF-8 encoding without byte order mark (BOM).

LocalSettings.php contains PHP code; mainly the definition of variables and their values. Changing a setting usually means changing the value of a PHP variable. Your changes will take effect immediately after saving the file again on the server: There is no need to manually "restart" anything. Anyway, in some cases you may need to clear your browser's cache to actually see the changes you made.

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.php and modify it appropriately in LocalSettings.php. Within LocalSettings.php you can add new lines at the end.

Within the file, there can also be several lines such as 'require_once "$IP/extensions/extension.php";', which point to [[<tvar name=ext-content>Special:MyLanguage/Extension:Contents|extensions]]. These lines enable the according extension in the wiki. Those extensions may require setting the values of more variables in LocalSettings.php; check the documentation of the according extension for further instructions.

Like most PHP files in MediaWiki, LocalSettings.php does not end with the closing PHP tag. This prevents admins from accidentally adding new information after this tag. PHP works fine without a closing tag.

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. <tvar name=wikiaforum>[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.

{{note|1= This file is not written to your webserver automatically for security reasons. Instead, it is offered as a download, which you must then upload to your server for your wiki to begin working. For a more complete explanation, see [<tvar name=installer>//www.mediawiki.org/w/index.php?title=New-installer_issues&diff=334526&oldid=333913 this explanation].]]

Overview of available settings

See the [[<tvar name=config>Special:MyLanguage/Manual:Configuration settings|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.

Standard settings

Install path

The $IP (install path) variable holds the local file path to the base installation of your wiki. Since MediaWiki 1.18, the system sets $IP automatically. Setting {{phpi|$IP]] manually in LocalSettings.php is no longer needed. {{phpi|$IP]] will default to the current working directory and can be used without the need to manually define it. Attempting to set {{phpi|$IP]] (or MW_INSTALL_PATH) in LocalSettings.php may produce unexpected results.

The DefaultSettings.php file gets loaded from the directory designated by the IP variable.

Site name

$wgSitename holds the name of your wiki setup. This name gets included many times throughout the system, such as via MediaWiki:Pagetitle. For instance, the Wikipedia tagline "From Wikipedia, the free encyclopedia" makes use of this setting.

Declensions of site name

Some translations of interface are ready for inflection of site name. You can set proper forms of word in variables $wgSitename documentation page).

Site language

$wgLanguageCode 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 contains the base URL of the server, including protocol but without the trailing slash and without the subdirectory if any. When the wiki is accessed from either the localhost where it runs, from an intranet or from the internet, email notifications and a few other computed messages would be usually delivered with the different URLs.

From MediaWiki 1.34 {{phpi|$wgServer]] must be set in LocalSettings.php. Prior to that, MediaWiki tried to autodetect the name of the server and {{phpi|$wgServer]] was optional, to override the autodetection.

If www.example.com is the server address of your wiki as seen from the internet, add a line such as

$wgServer = 'http://www.example.com';

The magic word variable {{SERVER]] can be used on wiki pages; it equals the value of {{phpi|$wgServer]]; however, on a wiki, such as those in the Wikimedia family, where relative urls are used, it will not fully expand, for example here it displays {{SERVER]], which can neither be clicked nor copy-pasted into the address bar as it is.

You can also use a protocol relative URL as shown below. When using a protocol relative URL, be sure to set {{phpi|$wgCanonicalServer]]. {{phpi|$wgCanonicalServer]] is needed for some places in the code where an origin with a protocol and hostname is needed.

$wgServer = '//www.example.com';
$wgCanonicalServer = 'https://www.example.com';

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.

Article path

$wgArticlePath is the path to use when accessing a page in MediaWiki. The path should contain the path to the main script (usually making use of {{phpi|$wgScript]]) and use the $1 placeholder for the article name.

If you are using Apache rewrite rules to create pretty and short URLs, you probably need to adjust {{phpi|$wgArticlePath]] to address the right path. Note that wgArticlePath is used to construct URLs from within MediaWiki. If you make a mistake here, internal links will show up incorrectly while you still may be able to access the main page by specifying the correct URL manually. See Manual:Short URL for more information on URL configuration.

Typical values are:

"$wgScript/$1" pass the article name with separator "/"
"$wgScript?title=$1" pass the article name as a parameter (old style)
"/mypath/$1" custom path. Use Apache rewrite rules to convert "mypath" to the proper path accessing the main script

Stylesheet location

Use $wgStylePath to set the URL path to the place where the stylesheets (CSS) for the MediaWiki installation are located. $wgStyleDirectory 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. $wgUploadDirectory points to the local file system path.

$wgLogo specifies which graphical logo is displayed in the top left corner of all MediaWiki pages. These steps replace the default logo in the /wiki/skins/common/images/ directory, replacing /wiki with the path to the directory where you installed the MediaWiki software.

First, copy whatever logo you want into the /wiki/skins/common/images/ directory (replacing /wiki with the path to the directory where you installed the MediaWiki software).

Next, try to find the line that looks like this in LocalSettings.php:

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

If there's no such line, you can copy and paste the line above at the end of the file.

Then, modify that line to point to your logo. The logo must be web accessible. The value of this variable is passed to the web browser, which uses it to fetch the logo. If in doubt, a good way to pick what to put here is navigate to the logo in your web browser (for example, this wiki the url of the logo is Wiki.png ), and put the full URL as the value of this variable.

Some people just replace the skins/common/images/wiki.png file with their logo. This is not recommended, as the customized logo would be overwritten on upgrade.

MediaWiki 1.35 introduced $wgLogos, which allows multiple versions of the same logo. An example of using multiple logos is shown below.

$wgLogos = [
'1x' => "$wgStylePath/common/images/1x_version.png",
'1.5x' => "$wgStylePath/common/1.5x_version.png",
...
'tagline' => [
'src' => "$wgStylePath/common/tagline_version.png",
'width' => 135,
'height' => 15,
],
];

Contact info

$wgEmergencyContact is the email address of the user to contact if something goes wrong. This email address is used to send internal bug reports to. As an administrator, you want to include your email address here.

$wgPasswordSender is the email address where email 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.

Database settings

MediaWiki needs access to the database (currently either MySQL or PostgreSQL) to store pages, modifications, user information, and a lot more things.

$wgDBserver contains the hostname where the database is hosted on. In most cases this will be just "localhost" as the database is run on the same system, but for distributed installations, you need to fill in the fully qualified domain name of the computer running the database.

$wgDBname is the database name of the database to be used by MediaWiki. A single MySQL or PostgreSQL installation can store more than one database and you can even run many MediaWiki installations on a single server. Make sure you have stated the correct database name here and use different database names for different wiki installations on the same database server.

$wgDBpassword contain the login name and password to be used by MediaWiki to access the database. Make sure the specified user has the proper access rights to be able to manipulate the wiki's table on the database server.

Also see Manual:Securing database passwords for a method to move the sensitive parts of LocalSettings.php to a different file in a different directory.

User rights

$wgGroupPermissions is an associative array, controlling permissions for creating and editing pages for your different user groups. In this array, custom permission levels can be created, and permission levels for the different user groups can be set. See Help:User rights for more information about the different permissions and user groups available.

Force capital links

By default, no page name can start with a lowercase Roman letter: in an attempt to do so the first letter is converted to uppercase; if a link target, included page, image or category is specified with a name starting with a lowercase letter, the actual target etc. is the page starting with the corresponding capital.

Alternatively page names can start with a lowercase letter, in addition to the possibilities of starting with a capital, a digit, etc. For that you must adjust $wgCapitalLinks. Setting it to false allows lowercase characters, true chooses the default behavior.

Enabling subpages

In LocalSettings.php, [[$wgNamespacesWithSubpages. For example, to enable subpages in the main namespace:

$wgNamespacesWithSubpages[NS_MAIN] = 1;

Image uploads

Before users are allowed to upload files to the MediaWiki system, you have to enable that feature. Make sure the Upload Directory is properly configured and writeable by the Apache web server process. Then set $wgEnableUploads to true to allow uploading in the web user interface.

i.e. Here's some example code from includes/DefaultSettings.php to put in LocalSettings.php:

$wgUploadPath = "$wgScriptPath/uploads"; ## Wiki 1.5 defaults to /images, but allows more than just images
$wgUploadDirectory = "$IP/uploads"; ## Wiki 1.5 defaults to /images, but allows more than just images

## To enable image uploads, make sure the above '$wgUploadPath' directory is writable by Apache User or group.
## ''(i.e. chmod og+w uploads images)'' then the following should be true:
$wgEnableUploads = true;
$wgUseImageMagick = true;
$wgImageMagickConvertCommand = "/usr/bin/convert";

## If you want to use image uploads under safe mode, create the directories images/archive, images/thumb and
## images/temp, and make them all writable. Then uncomment this, if it's not already uncommented:
$wgHashedUploadDirectory = false;

If you want to be able to resize images on the fly to support thumbnails, MediaWiki needs a working ImageMagick installation. Set $wgUseImageMagick to true once you have installed and tested ImageMagick on your system. Make sure $wgMaxShellMemory is large enough. See Manual:Image administration#Image thumbnailing for detailed information and troubleshooting.

Also, you may want to modify the list of accepted extensions, which is stored within $wgFileExtensions:

$wgFileExtensions = [ 'png', 'jpg', 'jpeg', 'ogg', 'doc', 'xls', 'ppt', 'mp3', 'sxc', 'pdf' ];

In case ImageMagick outputs an error message similar to the following:

Fatal error: mime_magic could not be initialized, magic file is not available in includes/MimeMagic.php on line 506

then try adding the following line to LocalSettings.php:

$wgMimeDetectorCommand = {{#tag:span|"file -bi"|class=s2]];

{{note|1= Read the upload security section in the Manual:Security.

Further information is available in:

]]

Interwiki support

InterWiki support is built into MediaWiki but you need to configure the prefix to be used for your internal links. This prefix is usually the same as {{wg|Sitename]], but in case you need to change that, you set the {{wg|LocalInterwikis]] variable to the preferred name.

Language of user interface

MediaWiki allows for a variety of localized user interfaces languages instead of the English default. If you want to run your wiki in a non-English language, set the variable to the proper language code (e.g. "de" for German, "es" for Spanish, etc.)

You may use any of the languages with a file in the directory {{git file |file=languages/i18n]]. E.g. if you find es.json, then you can use "es" for Spanish. Do not use "Es" with a capital letter. Although it seems to work, not all texts are translated.

{{note|1= After changing the language code, you will need to run a PHP script to make it work. In a terminal window, change to your wiki directory, change to the maintenance folder, and enter php rebuildMessages.php --rebuild. On Windows, the PHP folder might not be in your PATH environment variable and you'll have to prefix php with the path to the program.]]

Not all languages are supported. See the [<tvar name=url>https://translatewiki.net/w/i.php?title=Special:MessageGroupStats&group=mediawiki translation statistics on TranslateWiki] for an up-to-date list of which languages are supported and to what extent. That list reflects the current state of MediaWiki core, so depending on what version you are using there may be a discrepancy.

Setting copyright for the site

  • $wgRightsPage is the page on the wiki that covers the copyrights that it falls under. Usually, this will be Project:Copyrights.
  • $wgRightsText is the text in the footer that follows "Content is available under". It will be linked to the page specified in $wgRightsPage.
  • $wgRightsIcon is the URL of the image placed at the left of the footer.

{{note|1= If $wgRightsPage is non-empty, the link in the copyright/license notice will link to that page on your site. If $wgRightsPage is empty then the copyright/license notice will link to $wgRightsUrl instead.]]

To modify the copyright statements of the site, add something like this to LocalSettings.php:

$wgRightsPage = "YourWiki:Copyright";
$wgRightsText = "copyright YourWiki";

Afterwards, edit MediaWiki:Copyright to provide an appropriate message, using "$1" to indicate the position where the link to your copyright page will be.

Example: setting a Creative Commons license

To set a Creative Commons license do the following:

<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">
<img alt="Creative Commons License" border="0" src="http://creativecommons.org/images/public/somerights30.png" />
</a>
This work is licensed under a
<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License</a>.
  • For $wgRightsURL enter the href info from the first anchor:
$wgRightsUrl = "http://creativecommons.org/licenses/by-nc-sa/3.0/";
  • For $wgRightsText enter the text the second anchor links from (add the "a" to the Wiki variable for a more grammatically correct version)
$wgRightsText = "a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License";
  • For $wgRightsIcon enter the src info from the img link in the first anchor. You want to copy the badge to your own site instead of using the one from the Creative Commons site.
$wgRightsIcon = "http://creativecommons.org/images/public/somerights30.png";
  • For using RDF metadata about copyright add one or both of the following lines to your LocalSettings.php:
$wgEnableCreativeCommonsRdf = true;
$wgEnableDublinCoreRdf = true;

Custom namespaces

By declaring $wgNamespaceAliases array namespace aliases can be added. Take heed not to have any pages already titled in that namespace, for instance if you had a page called "Technical:Support" and you created the Technical: namespace, then that page would not only be lost, but you cannot remove it from Special:Allpages. To fix this delete the namespace, move "Technical:Support" to "Support" in mainspace, delete the redirect, reinsert the namespace, and move it back to "Technical:Support". See Custom namespaces for more information as to how to do so.

The default skin of the site can be modified via $wgDefaultSkin.

See also

  • {{file doclink |LocalSettingsGenerator]] source code, which generates the inital contents of LocalSettings.php during installation.
  • [[<tvar name=wfamily>Special:MyLanguage/Manual:Wiki family|Wiki families]] can share the same {{BASEPAGENAME]].

[[Category:MediaWiki configuration{{#translation:]]| ]]

TMP

$wgReadOnly
  • setzt das Wiki auf schreibgeschützt
  • angegebenen Zeichenfolge als Grund
  • nützlich für die Wartung der Website
/mw-config/

Links

  1. https://www.mediawiki.org/wiki/Manual:Configuration_settings/de
  2. https://www.mediawiki.org/wiki/Manual:LocalSettings.php