Wednesday 5 March 2014

How do I get PHP remote debugging working under Komodo?

Question:

How do I get PHP remote debugging working under Komodo?
Answer:

There are a couple of things you need to make sure of in order to get PHP remote debugging working:

1. xdebug must be configured correctly. The php.ini that your web server is using should contain statements like this:

; xdebug config for Linux and Mac OS X
zend_extension=/usr/share/php5/debug/xdebug.so
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=foo.bar.com
xdebug.remote_port=9000
xdebug.idekey=kyla

Note in particular that remote_host needs to be the hostname or ip address of the machine Komodo is running on, and remote_port needs to be the same as the remote port Komodo is using. You can check this by creating a script like this:



...and looking at the xdebug section in the output page.

2. Komodo must be configured correctly. At

Preferences / Debugger / Proxy

...set the field 'Listen for debug connections on port' to 9000 as above. Close the preferences and make sure that

Debug / Listen for remote debugger

...has a checkmark beside it.

3. You need to explicitly initiate a debugger session by adding the XDEBUG_SESSION_START get variable to the url in your browser:

http://baz.bar.com/script.php?XDEBUG_SESSION_START=1

If everything is correct, Komodo should pop-up a dialog inidicating that a remote application has requested a debugging session. If you click on 'OK', Komodo will step in to the first line of code in that script.

If this is still not working, some things to check are:

- can you ping the machine Komodo is running on form your web server?
- is the machine Komodo is on running some sort of software firewall that might be blocking the debugger requests?

No comments: