MediaWiki Interaction[edit]

You can get a shell as your current user in the main MediaWiki container easily:

mw docker mediawiki exec bash

You can use the exec command to perform actions inside the MediaWiki container as a one off...

Such as, watching logs

mw docker mediawiki exec -- tail -f /var/log/mediawiki/debug.log

PHPUnit tests[edit]

You can run PHPUnit tests in the MediaWiki container easily:

mw docker mediawiki exec -- composer phpunit tests/phpunit/unit/includes/XmlTest.php

Note Note: You may still need to use the old phpunit.php test running for some PHPUnit tests!

mw docker mediawiki exec -- php tests/phpunit/phpunit.php tests/phpunit/unit/includes/xml/XmlTest.php

If you want to run tests with the debugger, see the XDebug section below.


The default XDebug mode is develop,debug, and the debugger will try to connect to localhost:9003.

If you want to alter the XDebug config you can do so using an environment variable.

mw docker env set MEDIAWIKI_XDEBUG_MODE "develop,debug,profile"
mw docker env set MEDIAWIKI_XDEBUG_CONFIG "client_host="

It often makes sense to set the client_host to the public IP address of your physical device in your local network (i.e. wifi or ethernet IP).

You can set multiple xDebug config variables by leaving a space between them, for example:

mw docker env set MEDIAWIKI_XDEBUG_CONFIG "client_host= client_port=9000"

If you change these environment variables after the MediaWiki containers are already running, you will need to recreate them to have the settings take effect.

mw docker mediawiki create

Triggering for requests[edit]


Example triggering from CLI inside the MediaWiki container:

XDEBUG_SESSION=1 php test.php

Running with tests[edit]

You can run exec commands with environment variables, for example, if you want to make use of XDEBUG to step through a specific test in your IDE:

mw docker mediawiki exec -- XDEBUG_SESSION=1 PHP_IDE_CONFIG='serverName=<name configured in PHPStorm>' php tests/phpunit/phpunit.php <path to test>