I’ve just struggled for the last hour trying to set up xdebug remote debugging using NetBeans. Having found the solution, I’ve decided to write about the step to get this working to help anyone else out who may be stuck.

On my set up I have two machines. The development machine (that has xdebug installed) on 192.168.0.109 and my local work machine that is on 192.168.0.108. In the xdebug configuration ini, enter the following parameters;

zend_extension=/path/to/your/xdebug.so
xdebug.remote_enable=on
xdebug.remote_handler="dbgp"
xdebug.remote_host=192.168.0.108
xdebug.remote_port=9000
xdebug.idekey="netbeans-xdebug"

What may strike you as a little odd when reading it is the remote host address is my local machine. This is what caught me out. I’m not 100% sure why this has to be but it won’t work without it. After you have done this, restart your web server and make some configuration changes in NetBeans.

In NetBeans, go to Tools > Options > PHP (General Tab). In the debugging section, make sure the port is at 9000 (or whatever you specified in the config ini) and the session ID is what you set the xdebug.idekey value at (netbeans-xdebug).

Now you’re good to go!

Advertisement