After installation, MediaWiki’s behaviour is controlled byDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/wikimedia/mediawiki/llms.txt
Use this file to discover all available pages before exploring further.
LocalSettings.php in the root of your installation. This file is generated by the installer and must be customised for your deployment.
LocalSettings.php Overview
LocalSettings.php is a PHP file executed on every request. It sets global variables that override defaults defined in includes/MainConfigSchema.php. Variable names follow the $wg prefix convention (e.g. $wgSitename, $wgDBtype).
Essential Settings
Site Identity
| Variable | Default | Description |
|---|---|---|
$wgSitename | 'MediaWiki' | Name of the wiki. Shown in the browser title bar and email notifications. Must be changed. |
$wgServer | false | Full URL of the server (e.g. 'https://wiki.example.com'). Must be set. |
$wgScriptPath | (auto) | Relative URL path to the MediaWiki root (e.g. '/wiki' or '' for the domain root). |
$wgArticlePath | (auto) | URL pattern for articles. Defaults to "$wgScriptPath/index.php?title=$1". |
Security Key
$wgSecretKey must always be set to a long, random string. It is used to sign cookies, session tokens, and other security-sensitive values.
Database Configuration
- MySQL / MariaDB
- PostgreSQL
- SQLite
Requires the Create the database and user before running the installer:
mysqli PHP extension.File Upload Configuration
File uploads are disabled by default. To enable them:| Variable | Default | Description |
|---|---|---|
$wgEnableUploads | false | Set to true to allow users to upload files. |
$wgUploadPath | "$wgScriptPath/images" | URL path to the upload directory. |
$wgUploadDirectory | "$IP/images" | Filesystem path to the upload directory. Must be writable by the web server. |
For image thumbnailing, install the
gd or imagick PHP extension. For EXIF metadata display, install exif.images/ directory is writable:
Email Configuration
Email is enabled by default ($wgEnableEmail = true). MediaWiki uses PHP’s mail() function unless you configure SMTP.
SMTP
To send mail via a dedicated SMTP server, set$wgSMTP to an array:
$wgSMTP = false (the default) to use PHP’s mail() function instead.
| Variable | Default | Description |
|---|---|---|
$wgEnableEmail | true | Master switch for all email features (password resets, notifications). |
$wgEnableUserEmail | true | Allow user-to-user email via Special:EmailUser. |
$wgEmailAuthentication | true | Require email confirmation before sending notifications. Prevents spam relay. |
$wgSMTP | false | SMTP configuration array, or false to use mail(). |
$wgPasswordSender | 'apache@<hostname>' | The From address for password reminders and notifications. |
Cache Backends
By default,$wgMainCacheType is CACHE_NONE (constant 0), which disables caching. Enabling a cache significantly improves performance.
- APCu
- Memcached
- Redis
- Database
Fastest option for single-server deployments. Requires the
apcu PHP extension.Key Security Settings
| Variable | Default | Notes |
|---|---|---|
$wgSecretKey | false | Must be set. Used to sign cookies and tokens. |
$wgForceHTTPS | false | Set to true to redirect all HTTP requests to HTTPS. |
$wgEmailAuthentication | true | Require email verification before sending mail. Prevents spam abuse. |
$wgEditPageFrameOptions | 'DENY' | Sends X-Frame-Options: DENY on edit pages to prevent clickjacking. |
$wgAllowUserJs | false | Allow users to run custom JavaScript. Increases XSS risk. |
$wgAllowUserCss | false | Allow users to apply custom CSS. |
$wgBreakFrames | false | Set to true to break out of framesets on all pages. |
$wgDBssl | false | Connect to the database over SSL (MySQL/MariaDB and PostgreSQL). |
