This page is a translated version of the page Manual:LocalSettings.php and the translation is 48% complete.
Outdated translations are marked like this.
Peringatan Peringatan Jangan sunting LocalSettings.php dengan editor dokumen seperti Notepad, TextEdit, atau editor teks lainnya yang menambahkan tanda urutan byte ke berkas. Ini memecahkan runtime PHP dari wiki Anda. Sebagai gantinya, gunakan editor kode, mis. Vim, Notepad++, atau Atom. Ini dapat menangani enkodingan berkas dengan benar. Mereka juga dapat digunakan untuk memperbaiki berkas yang sebelumnya rusak oleh editor dokumen.

Berkas LocalSettings.php menyediakan pengaturan konfigurasi dasar (didasarkan pada berkas DefaultSettings.php ) dari sebuah intalasi MediaWiki. Anda harus mempergunakan waktu untuk meninjau ulang pengaturan di berkas ini. Berkas tersebut biasanya dibuat oleh penginstal berbasis-web MediaWiki tetapi Anda dapat meningkatkan parameternya, mungkin dalam konser dengan pengaturan Apache. Untuk instalasi MediaWiki yang dikonfigurasi sebagai sebuah peternakan wiki, sebuah berkas yang bernama CommonSettings.php mungkin akan digunakan.

Lokasi di server

Berkas LocalSettings.php bukanlah sebuah halaman wiki dan Anda tidak bisa mengaksesnya dengan penjelajah web Anda. Melainkan, berkas tersebut adalah sebuah berkas di sistem berkas peladen. Isinya dibuat saat pengaturan awal wiki dan berkas yang dihasilkan harus disalin ke peladen secara manual. Berkas ini harus terletak di folder di mana Anda memasang MediaWiki, di level yang sama dengan folder includes/ dan skins/ dan berkas api.php. Jika berkasnya tidak di sana, wikinya tidak akan bekerja sama sekali - jika wikinya bekerja, maka berkasnya pasti ada di sana. Jika Anda tidak tahu letaknya, Anda bisa memasukkan perintah seperti find / -iname LocalSettings.php -print di jendela terminal untuk mencarinya.

(Jika Anda menggunakan Vagrant, lihat pula MediaWiki-Vagrant#Pengaturan_MediaWiki.)


LocalSettings.php biasanya berisi data sensitif seperti basis data masuk log. Data ini jangan pernah diungkapkan kepada publik! Dikarenakan suatu celah keamanan di peladen, bisa jadi pengguna lain bisa melihat isi berkasnya. Untuk meningkatkan keamanan data Anda, Anda sebaiknya menetapkan izin UNIX untuk berkas ini sebagaimana berikut: Pengguna webserver harus punya akses ke berkas ini. Jika ini adalah akun yang sama dengan pemilik berkas, maka Anda bisa mengatur izinnya menjadi 600. Terkadang, pengguna webserver bukan pemilik berkas, tetapi mereka ada di kelompok pengguna Unix pemilik. Kalau begitu, izin 640 harusnya cukup. Untuk meningkatkan keamanan, Anda sebaiknya memperkecil izinnya sekecil mungkin.

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.

Konten berkas

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.

Standar nilai lebih banyak pengaturannya di includes/DefaultSettings.php, yangmana harus tidak boleh diedit; jika variabel yang ingin Anda ubah tidak tersedia di LocalSettings.php, salin baris yang tepat di DefaultSettings.php dan modifikasi dengan tepat pada LocalSettings.php. DenganLocalSettings.php Anda dapat menambahkan baris baru diakhirnya.

Within the file, there can also be several lines such as 'require_once "$IP/extensions/extension.php";', which point to 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.[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.

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 this explanation.

Ikhtisar pengaturan yang tersedia

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.

Pengaturan standar

Jalur pemasangan

Variabel $IP (install path, jalur penginstalan) menyimpan jalur berkas lokal ke dasar instalasi wiki Anda. Sejak MediaWiki 1.18, sistem menetapkan $IP secara otomatis. Menetapkan $IP secara manual di LocalSettings.php tidak lagi diperlukan. $IP akan otomatis bernilai direktori kerja yang sekarang dan bisa digunakan tanpa perlu ditentukan secara manual. Since MediaWiki 1.18, the system sets $IP automatically. Setting $IP manually in LocalSettings.php is no longer needed. $IP will default to the current working directory and can be used without the need to manually define it. Attempting to set $IP (or MW_INSTALL_PATH) in LocalSettings.php may produce unexpected results.

Berkas DefaultSettings.php dimuat dari direktori yang ditentukan oleh variabel IP.

Nama situs

$wgSitename memegang nama pemasangan wiki Anda. Nama ini digunakan di banyak tempat di sistem, seperti lewat MediaWiki:Pagetitle. Contohnya, tagline Wikipedia "Dari Wikipedia, ensiklopedia bebas" menggunakan pengaturan ini.

Deklinasi dari nama situs

Beberapa terjemahan antarmuka sudah siap untuk infleksi nama situs. Anda bisa menetapkan bentuk proper kata di variabel $wgGrammarForms (untuk contohnya lihat halaman dokumentasi $wgGrammarForms ).

Bahasa situs

$wgLanguageCode mengendalikan bahasa antarmuka wiki Anda. Meskipun pengguna bisa mengubah bahasa yang mereka lihat di preferensi mereka, variabel ini menentukan bahasa baku yang semua pengguna anonim dan kebanyakan pengguna terdaftar lihat.

Jalan skrip

$wgScriptPath adalah prefiks jalur URL untuk mengakses skrip MediaWiki utama yang merupakan potongan kode terpenting MediaWiki. This setting should correspond to the Apache settings, especially if you are using Apache's rewrite rules.

Nama server

$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 $wgServer must be set in LocalSettings.php. Prior to that, MediaWiki tried to autodetect the name of the server and $wgServer was optional, to override the autodetection.

Jika adalah halaman server dari wiki Anda seperti yang terlihat dari internet, tambahkan sebuah garis seperti

$wgServer = '';

The magic word variable {{SERVER}} can be used on wiki pages; it equals the value of $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 //, 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 $wgCanonicalServer. $wgCanonicalServer is needed for some places in the code where an origin with a protocol and hostname is needed.

$wgServer = '//';
$wgCanonicalServer = '';

Nama skrip

$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.

Jalan artikel

$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 $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 $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.

Nilai-nilai khas adalah:

"$wgScript/$1" lewati nama artikel dengan pemisah "/"
"$wgScript?title=$1" lewati nama artikel sebagai sebuah parameter (gaya lama)
"/mypath/$1" jalur khusus. Gunakan aturan penulisan ulang Apache untuk mengkonversi "mypath" ke jalur yang tepat saat mengakses skrip utama

Lokasi gaya gambar

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.

Lokasi pengunggahan

The upload directory is the place where files uploaded by the users are stored. $wgUploadPath specifies the URL path, $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.

Pertama, salin logo apapun yang Anda inginkan ke direktori /wiki/skins/common/images/ (gantikan /wiki dengan alamat direktori tempat dimana Anda menginstal perangkat lunak MediaWiki).

Selanjutnya, coba untuk menemukan baris yang mirip seperti ini di LocalSettings.php:

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

Jika baris tersebut tidak ada, Anda dapat menyalin dan menempelkan baris di atas ke bagian bawah dari berkas.

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 ), 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,

Info kontak

$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.

Pengaturan basis data

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.

$wgDBuser and $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.

Hak akses pengguna

$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.

Aktifkan subhalaman

In LocalSettings.php, subpages are enabled on a per-namespace basis using $wgNamespacesWithSubpages . For example, to enable subpages in the main namespace:

$wgNamespacesWithSubpages[NS_MAIN] = 1;

Unggah berkas

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 $wgImageMagickConvertCommand points to the proper location of the convert command of your installation, that the command is executable by the web server process, and $wgMaxShellMemory is large enough. See Manual:Image administration#Image thumbnailing for detailed information and troubleshooting.

Selain itu, Anda mungkin ingin mengubah daftar ekstensi yang diterima, yang tersimpan di dalam $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

kemudian coba tambahkan baris berikut ke LocalSettings.php:

$wgMimeDetectorCommand  = "file -bi";

Dukungan interwiki

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 $wgSitename , but in case you need to change that, you set the $wgLocalInterwiki variable to the preferred name.

Bahasa antarmuka pengguna

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 $wgLanguageCode 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 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.

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 here for a list of the localisation statistics of 1.38.0-wmf.5 (d7f97b4). See for the statistics per released version.

Atur hak cipta untuk situs

  • $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.
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.

Untuk mengubah pernyataan hak cipta dari situs, tambahkan sesuatu seperti ini di 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.

Contoh: atur sebuah lisensi Creative Commons

Untuk mengatur sebuah isensi Creative Commons, lakukan langkah berikut ini:

<a rel="license" href="">
<img alt="Creative Commons License" border="0" src="" />
This work is licensed under a
<a rel="license" href="">
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License</a>.
  • For $wgRightsURL enter the href info from the first anchor:
$wgRightsUrl = "";
  • 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 = "";
  • For using RDF metadata about copyright add one or both of the following lines to your LocalSettings.php:
$wgEnableCreativeCommonsRdf = true;
$wgEnableDublinCoreRdf = true;

Ruang nama ubah suaian

By declaring $wgExtraNamespaces , and modifying $wgNamespacesWithSubpages , and $wgNamespacesToBeSearchedDefault , extra namespaces can be added to a MediaWiki installation; and by declaring the $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 .

Lihat pula