PHP XDebug

James Silver edited this page Jun 5, 2013 · 2 revisions

We install and configure the XDebug PHP extension by default.


XDebug is configured with sensible defaults, but as these are simply PHP configuration variables they can easily be changed in the same way as any other PHP configuration

We configure XDebug to make connections to the host machine, on port 9000 over the dbgp protocol.

Our XDebug base configuration looks like this:

; Enable remote debugging
; Stop potential inifinte loops, while allowing enough depth for Drupal

; Set the remote address to the default address of our host machine, magic.
; Output links compatible with the PHPStorm Remote Call plugin running on the host. 
xdebug.file_link_format="javascript:var rq = new XMLHttpRequest();\"GET\", \"http://localhost:8091?message=%f:%l\", true); rq.send(null);"

PHPStorm Remote Call plugin

If you use the PHPStorm IDE for development then install the 'Remote Call' plugin from the Plugins manager inside PHPStorm (Preferences > Plugins). Now the rows in XDebug stack traces (which are displayed in the browser when there's a fatal error) will be clickable links which jump you straight to the file/line in PHPStorm!