Jump to content

Local development quickstart: Difference between revisions

From mediawiki.org
Content deleted Content added
add `--overwrite` flag to `brew link` step on Mac. This seems to be needed to have php 8.2 in the PATH
m Remove extra spaces
 
(14 intermediate revisions by 8 users not shown)
Line 1: Line 1:
<languages/>
<languages/>
{{InstallationNav}}
<translate><!--T:1--> This page is a '''quickstart''' guide to setting up a local development for MediaWiki using PHP and Composer.</translate>
<translate><!--T:1--> This page is a '''quickstart''' guide to setting up a local development for MediaWiki using PHP and Composer.</translate>


Line 6: Line 7:
<translate>
<translate>
== Install prerequisites == <!--T:28-->
== Install prerequisites == <!--T:28-->

<!--T:4-->
MediaWiki requires PHP <tvar name=1>{{MW stable php requirement}}</tvar>+ and Composer 2.
</translate>
</translate>
<translate><!--T:40--> MediaWiki's master branch requires {{<tvar name=1>ll|Compatibility#PHP</tvar>|PHP 8.3.0+}} and Composer 2.</translate>
{{void|1=<translate><!--T:4--> MediaWiki requires PHP <tvar name=1>{{MW stable php requirement}}</tvar>+ and Composer 2.</translate>}}


{{TabbedWindowBegin}}
{{TabbedWindowBegin}}
Line 17: Line 17:
<translate>
<translate>
<!--T:5-->
<!--T:5-->
On Ubuntu 22+ or Debian 12+, install the required packages using [[w:APT (software)|APT]].
On Ubuntu <tvar name=1>24</tvar>+ or Debian <tvar name=2>13</tvar>+, install the required packages using [[w:APT (software)|APT]].
</translate>
</translate>


Line 24: Line 24:
</syntaxhighlight>
</syntaxhighlight>


<translate><!--T:7--> On Fedora 36+, install the required packages using [[w:DNF (software)|DNF]].</translate>
<translate><!--T:7--> On Fedora <tvar name=1>40</tvar>+, install the required packages using [[w:DNF (software)|DNF]].</translate>


<syntaxhighlight lang="bash" copy style="max-width: fit-content;">
<syntaxhighlight lang="bash" copy style="max-width: fit-content;">
Line 37: Line 37:


=== Mac ===
=== Mac ===

<translate>
<translate>
<!--T:9-->
<!--T:9-->
Install the required packages using [<tvar name=url>https://brew.sh/</tvar> Homebrew].
Install the required packages using [<tvar name=url>https://brew.sh/</tvar> Homebrew] and make it the active version of PHP, by linking it.
</translate>
</translate>


<syntaxhighlight lang="bash" copy style="max-width: fit-content;">
<syntaxhighlight lang="bash" copy style="max-width: fit-content;">
brew install php@8.2 composer
brew install php@8.5 composer
brew link --overwrite php@8.2
brew link --overwrite php@8.5
</syntaxhighlight>
</syntaxhighlight>


<translate><!--T:38--> If the following command succeeds, it should show the PHP version.</translate>
=== Windows ===
<translate><!--T:39--> If it fails, likely your <tvar name=1>$PATH</tvar> is not configured to find commands from brew.</translate>


<syntaxhighlight lang="bash" copy style="max-width: fit-content;">
php -v
</syntaxhighlight>

=== Windows ===
<translate><!--T:10--> You have the option to use the [<tvar name=url>https://learn.microsoft.com/en-us/windows/wsl/about</tvar> Windows Subsystem for Linux] and follow the Linux instructions on this page.</translate>
<translate><!--T:10--> You have the option to use the [<tvar name=url>https://learn.microsoft.com/en-us/windows/wsl/about</tvar> Windows Subsystem for Linux] and follow the Linux instructions on this page.</translate>
<translate><!--T:11--> Or, to install MediaWiki directly on Windows, install the required packages using [<tvar name=url>https://chocolatey.org/install</tvar> Chocolatey].</translate>
<translate><!--T:11--> Or, to install MediaWiki directly on Windows, install the required packages using [<tvar name=url>https://chocolatey.org/install</tvar> Chocolatey].</translate>
Line 61: Line 66:


<syntaxhighlight lang="ini">
<syntaxhighlight lang="ini">
extension:fileinfo
extension=fileinfo
extension:intl
extension=intl
extension:pdo_sqlite
extension=pdo_sqlite
extension:zip
extension=zip
extension=sodium
</syntaxhighlight>
</syntaxhighlight>


Line 77: Line 83:


<syntaxhighlight lang="bash" copy style="max-width: fit-content;">
<syntaxhighlight lang="bash" copy style="max-width: fit-content;">
git clone https://gerrit.wikimedia.org/r/mediawiki/core.git mediawiki
git clone https://gerrit.wikimedia.org/r/mediawiki/core.git mediawiki
</syntaxhighlight>
<syntaxhighlight lang="bash" copy style="max-width: fit-content;">
git clone https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git mediawiki/skins/Vector
git clone https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git mediawiki/skins/Vector
</syntaxhighlight>
<syntaxhighlight lang="bash" copy style="max-width: fit-content;">
cd mediawiki
cd mediawiki
</syntaxhighlight>
</syntaxhighlight>

Latest revision as of 19:32, 28 July 2026



This page is a quickstart guide to setting up a local development for MediaWiki using PHP and Composer.

This workflow is only suitable for local development. To serve a public website, see Manual:Installation requirements .

Install prerequisites

MediaWiki's master branch requires PHP 8.3.0+ and Composer 2.

Linux

On Ubuntu 24+ or Debian 13+, 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 40+, 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 and make it the active version of PHP, by linking it.

brew install php@8.5 composer
brew link --overwrite php@8.5

If the following command succeeds, it should show the PHP version. If it fails, likely your $PATH is not configured to find commands from brew.

php -v

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
extension=sodium

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