Local development quickstart: Difference between revisions
Tacsipacsi (talk | contribs) As of yesterday, PHP 8.1+ is required. With this, Debian 11, Ubuntu 20.04 and Fedora 35 no longer package recent-enough PHP versions. (Fedora 35 has been EOL for 2.5 years, Ubuntu 20.04 for a week, so people should upgrade anyway. Debian 11 has LTS support until August 2026, but I don’t think there’s any official way of installing PHP 8.1 on it, so the only viable way of running MW locally is upgrading.) |
Tacsipacsi (talk | contribs) the -y/--noconfirm options exist because it’s generally not a good idea to skip confirmation; they’re for scripted use, which is probably not the case when one gets started with MediaWiki development |
||
| Line 21: | Line 21: | ||
<syntaxhighlight lang="bash" copy style="max-width: fit-content;"> |
<syntaxhighlight lang="bash" copy style="max-width: fit-content;"> |
||
sudo apt install |
sudo apt install php php-intl php-mbstring php-xml php-apcu php-curl php-sqlite3 composer |
||
</syntaxhighlight> |
</syntaxhighlight> |
||
| Line 27: | Line 27: | ||
<syntaxhighlight lang="bash" copy style="max-width: fit-content;"> |
<syntaxhighlight lang="bash" copy style="max-width: fit-content;"> |
||
sudo dnf install |
sudo dnf install php composer |
||
</syntaxhighlight> |
</syntaxhighlight> |
||
| Line 33: | Line 33: | ||
<syntaxhighlight lang="bash" copy style="max-width: fit-content;"> |
<syntaxhighlight lang="bash" copy style="max-width: fit-content;"> |
||
sudo pacman -S php composer |
sudo pacman -S php composer |
||
</syntaxhighlight> |
</syntaxhighlight> |
||
Revision as of 11:02, 7 June 2025
This page is a quickstart guide to setting up a local development for MediaWiki using PHP and Composer.
Install prerequisites
MediaWiki requires PHP 8.1.0+ and Composer 2.
Linux
On Ubuntu 22+ or Debian 12+, install the required packages using APT.
sudo apt install php php-intl php-mbstring php-xml php-apcu php-curl php-sqlite3 composer
On Fedora 36+, install the required packages using DNF.
sudo dnf install php composer
On Arch Linux, install the required packages using pacman.
sudo pacman -S php composer
Mac
Install the required packages using Homebrew.
brew install php@8.2 composer
brew link php@8.2
Windows
You have the option to use the Windows Subsystem for Linux and follow the Linux instructions on this page. Or, to install MediaWiki directly on Windows, install the required packages using Chocolatey.
choco install -y php composer
To load the required PHP extensions, edit your php.ini file, and uncomment the following lines.
To find the location of php.ini, run php --ini, and look for Loaded Configuration File.
extension:fileinfo
extension:intl
extension:pdo_sqlite
extension:zip
Clone MediaWiki
Use Git to clone the MediaWiki core repository and the default skin.
git clone https://gerrit.wikimedia.org/r/mediawiki/core.git mediawiki
git clone https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git mediawiki/skins/Vector
cd mediawiki
Cloning MediaWiki takes a few minutes. While you're waiting, if you plan to create and share patches, create a Wikimedia developer account if you don't already have one.
Install dependencies
From within your mediawiki directory, created above, use Composer to install MediaWiki's dependencies.
composer update
Install MediaWiki
Install MediaWiki with PHP's built-in SQLite database.
composer mw-install:sqlite
Start server
Start PHP's built-in webserver, and open localhost:4000 in a browser to see your MediaWiki instance.
To log in as an administrator, use username Admin and password adminpassword.
composer serve
Next steps
- Take a tour of the MediaWiki codebase – Familiarize yourself with MediaWiki's core code by learning about entry points and top-level directories.
- Run unit tests – MediaWiki uses the PHPUnit framework for unit and integration testing of PHP code. Read the docs to run tests and find information about writing tests.
- Install extensions – Add extensions, like VisualEditor and Echo, to your development environment. See Manual:Developing extensions to learn about how extensions work.
- Debug your code – Learn how to configure debugging aids, and debug MediaWiki code step-by-step with XDebug.
- Submit a patch – Explore Good first bugs, and configure SSH access to Wikimedia Gerrit to submit a patch.