Remote Debugging of PHP with Komodo IDE on Mac OS X

I am doing development on Mac OS X 10.7, with Komodo IDE 6.1.3 using PHP and Apache, both installed from Macports.

I want to enable remote debugging of my PHP scripts running under Apache using Komodo.  Following instructions from Activestate’s website, I have configured my system as shown below to make it work.

I have already installed Apache and PHP using Macports, so I only needed to install php5-xdebug using the following command:

sudo port install php5-xdebug

I then added the following to the /opt/local/etc/php5/php.ini file:

;xdebug config
;the .so file is loaded under /opt/local/var/db/php5/xdebug.ini
;zend_extension=no-debug-non-zts-20090626/xdebug.so
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
;xdebug.idekey=<idekey>

Then in Komodo IDE, set the tcp port to listen for debugging connection as shown below:

When I wish to debug a script, I just add the following query to the end of the browser url for the script, and xdebug sets a browser cookie that turns on debugging for all scripts from that point forwards.  The query string to add is:

?XDEBUG_SESSION_START=1

To disable the debugging again, you just need to delete the cookie from your browser.  Using Firefox, go to the Privacy settings under preferences:

Then click on the “remove individual cookies” link, and type in “localhost” as the search criteria for the cookie.  This will show all cookies for the localhost where you are debugging, and you will see the XDEBUG cookie as shown below.

Simply click on the Remove Cookie button, and debugging is turned off again.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

Up ↑

%d bloggers like this: