Setting up XDebug

Setting up XDebug

The Vagrant environment has xdebug installed. In order to get it working, you need to do a few things on your IDE.

PHPStorm

Set up the server:

Set up the Remote debug in the configuration section:

At this point, XDebug will begin to work. However, you will get a path mapping error. In order to resolve this, enter the path /var/www.

Note:

XDebug uses a cookie. As such, you cannot debug when passing through Varnish unless the cookie is in the list of allowed cookies in the Varnish configuration file. User the -d6phx.dev addresses for debugging.

Using Xdebug with curl

You can invoke Xdebug for a curl request by adding ?XDEBUG_SESSION_START=1 to the url, eg:

curl http://atd.dev/api/orders/1234?XDEBUG_SESSION_START=1

This works for all types of http request (not just GET).

 

blog tag: