Manual:Extensions/Installation and upgrade/en

Once installed, MediaWiki is ready to accept extensions. To add an extension follow these steps:

Before you start

 * Some extensions provide instructions designed for installation using Unix commands. You require shell access (SSH) to enter these commands listed on the extension help pages.
 * This page assumes your site settings are in a file called LocalSettings.php, but if you ase a different file, for instance in a wiki farm, the instructions should be equally relevant.

Get the file package
For each extension, read its documentation to find out about the appropriate download locations and methods. Common ways of downloading extensions include:


 * 1) Extension Distributor helps you to select and download most of the popular extensions, although not all extension developers necessarily recommend it.
 * 2) A list of extensions stored in the Wikimedia  is located at git:mediawiki/extensions.
 * 3) Some extensions are also available through:
 * , a dependency manager for PHP libraries. Many extensions can or should be installed using Composer. Proceed to for more information.
 * 1) Some extensions  and are not recommended.
 * 1) Some extensions  and are not recommended.
 * 1) Some extensions  and are not recommended.

Add the package to the folder
Extensions are usually distributed as modular packages. They generally go in their own subdirectory of.

You can add the file folder manually or have it transferred automatically if you use something like Git or Composer.

Install an extension

 * 1) Always check the requirements and instructions that come with each extension. The following summary applies to most extensions, but many extensions require different and/or additional steps to be taken.
 * 2) Ensure that required permissions are set.
 * 3) At the end of the   file, add: This line forces the PHP interpreter to read the extension file, and thereby make it accessible to MediaWiki. For an earlier installation method using   and how to migrate, see the instructions below.
 * 4) Configure if required or wanted.  should typically be added after including the extension. Again, check the extension's instructions for details.
 * 5) You may be required to run a maintenance script, for instance to add the necessary database tables.
 * 6) Done!

Possible issues

 * Some extensions can conflict with maintenance scripts, for example if they directly access $_SERVER (not recommended). In this case they can be wrapped in the conditional so maintenance scripts can still run.
 * The maintenance script will fail for any extension which requires customised namespaces which is included inside the conditional above such as,.

Add multiple extensions to
Especially if you have a large number of extensions, it may be useful to add them as an array to  (with plural -s) instead of adding them to separate instances of   (singular). For instance, to install Cite, ParserFunctions and SpamBlacklist, you could write:

wfLoadExtensions( [ 'Cite', 'ParserFunctions', 'SpamBlacklist' ] );

This method comes with one limitation, which is that you cannot point to custom file locations, as explained in this section.

Upgrade an extension
Some extensions require to be updated whenever you update MediaWiki, while others work with multiple versions.

To upgrade to a new version of an extension:


 * 1) Download the new version of the extension
 * 2) Replace all the extension files in the   directory with the new files. Do not remove the extension configuration present in LocalSettings.php
 * 3) If the extension requires changes to the MediaWiki database, you will need to run the  maintenance script. Most extensions will mention if this script needs to be run or not. (Perform backup of your data before executing the script). If you don't have command line access, you can also use the web updater.
 * 4) Documentation for an extension usually tells you what else you need to do.

Uninstall

 * 1) To uninstall the extension, remove the relevant lines from LocalSettings.php (  with the extension's name as well as any possible lines for associated configuration settings).
 * 2) Optionally, delete the file package from the /extensions folder.

Use custom locations
This must be done before you load any extensions or skins from non-standard directory locations:


 * If you keep your extensions in a location different from, you need to override , or use the second parameter of , to specify the directory in which to find the extension.
 * If one or more of your extensions are stored in additional locations, use the second parameter of  to specify the location of the   file for each of those extensions.




 * If your skins are not in, you need to override the poorly named , or use the second parameter of , to specify the directory in which to find the skin.
 * If one or more of your skins are stored in additional locations, use the second parameter of  to specify the location of the   file for each of those skins.



Migrate from require_once
Before MediaWiki 1.25, configuration for extensions and skins was done in a PHP file using the extension's or skin's name, for example  or. To install an extension with LocalSettings.php, you would use  to call this PHP file:

If the extensions are recent enough to support the current registration system, you would convert this to: