Help:Development environment setup
From Linux Web Expert
Some prerequisites to successfully setup a development environment.
- Operating System
- Apache
- MySQL, SQLite, Postgres
- PHP 5+
Various stacks are available and can help with the basic setup including LAMP, MAMP, XAMPP etc.
Is is also possible to use a Docker or mws:Vagrant environment for development tasks.
Environment setup
It is useful to setup the local wiki installation in a way that helps to detect and track down problems quickly. On the one hand, it is useful to use not-so-common installation settings to ensure that they are tested at some point:
- Use a non-empty DB table prefix when installing MediaWiki.
- Use $wgArticlePath = "$wgScript?title=$1"; in your LocalSettings.php (CGI compatibility mode). You may also change this back and forth to test both styles of URIs with your code.
- In addition, enable $wgShowSQLErrors = true; and $wgDebugDumpSql = true; in your LocalSettings.php.
On the other hand, some PHP-specific settings are useful for find code problems:
- The required version of PHP is found in INSTALL.
- All developers need to have all errors, warnings, and notices in PHP switched on. Edit your file php.ini to contain error_reporting = E_ALL and remove any other statement of this kind.
- If you are not running PHP 5.4 or later, then edit your php.ini to contain allow_call_time_pass_reference = Off. This directive was removed in PHP 5.4.
- Your final code should never create any of the respective messages.
- Enabling xdebug for your PHP improves the detail of the bug reports (the actual profiling feature of xdebug does not need to be enabled for this).