-
Notifications
You must be signed in to change notification settings - Fork 15
Setting up Xdebug
To be able to debug PHP with pugdebug, you need to have Xdebug properly set up for remote debugging.
Please read Xdebug's remote debugging documentation to learn all about it's remote debugging capabilities.
This document provides only example configurations that should help you get started more quickly.
A simple configuration enabling remote debugging:
xdebug.idekey=pugdebug
xdebug.remote_enable=1
xdebug.remote_port=9000
xdebug.remote_host=127.0.0.1
An example of Xdebug configuration for remote debugging a project that is inside a vagrant virtual machine:
xdebug.idekey=pugdebug
xdebug.remote_enable=1
xdebug.remote_port=9000
xdebug.remote_connect_back=1
Do note that when debugging CLI scripts from a vagrant virtual machine, the
remote_connect_back
setting will not work, and we need to use the
remote_host
setting. In that case, the Xdebug configuration should look something like:
xdebug.idekey=pugdebug
xdebug.remote_enable=1
xdebug.remote_port=9000
xdebug.remote_host=33.33.33.1
You can find the IP address to use for the remote_host
setting by issuing the
following command on the host machine:
ip addr
and a part of the output will include something like this:
6: vboxnet2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 1000
link/ether 0a:00:27:00:00:02 brd ff:ff:ff:ff:ff:ff
inet 33.33.33.1/24 brd 33.33.33.255 scope global vboxnet2
valid_lft forever preferred_lft forever
inet6 fe80::800:27ff:fe00:2/64 scope link
valid_lft forever preferred_lft forever
and on the third line of that output we can see the IP address of 33.33.33.1
.