Manual:How to debug/with MediaWiki-Vagrant and PHPStorm

From Linux Web Expert

Revision as of 13:29, 15 October 2023 by imported>Tgr (WMF)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

  1. Install an XDebug browser extension, such as XDebug helper (Chrome, Firefox).
  2. Start listening to XDebug connections in PHPStorm with the phone icon (see image in step 2 here)
  3. Switch on the XDebug browser extension
  4. In the PHPStorm configuration go to Languges & Frameworks > PHP > Servers
    1. Add a new server with name and host dev.wiki.local.wmftest.net, port 8080 (or whatever you configured; can be checked with vagrant config --get http_port)
    2. Check "Use path mappings"
    3. Below that, in the "Absolute path on the server" column set /vagrant in the row that corresponds to your vagrant directory, and /var/www to the row that corresponds to the srv/docroot subdirectory
  5. You are ready to go; set some breakpoints (by clicking on the empty space on the border to the left of your code) and make a request (reload the page or make it send an AJAX request)

For command-line debugging, instead of steps 1 and 3 you can use the xdebug_on command (and then xdebug_off to disable).

For other IDEs, see MediaWiki-Vagrant/Advanced_usage#MediaWiki debugging using Xdebug and an IDE in your host.