Debugging from Firefox with xdebug and Komodo

Standard
This post is over 9 years old and is probably out of date.

In an effort to switch away from Zend Studio I have been trying out Komodo (again), as I have no desire to be co-erced into Eclipse (and whilst Zend currently is promising to support Zend Studio, I think it’s pretty obvious that they will be moving entire to Zend Studio for Eclipse entirely before too long).

I have tried to use Komodo several times in the past, but have always found it not quite up-to par with Zend Studio.

I tried to review it again with 4.0, however it crashed repeatedly on Linux with my large project (75MB+), so I was never able to get a comprehensive enough feel such that I could do so. However, many people have extolled the virtues of Komodo and so I decided to give it another shot, now that it’s at 4.1.

This version has been rock solid, and so I was able to finally spend some time with it, setting it up “just-so” and such.

One of the last barriers to switching, has been to emulate the Zend Studio Toolbar for Firefox (also available for IE) which lets you do lots of great things, from Profiling to Debugging every page. I personally use it mostly for debugging single pages, and forms, as well as for end to end PHP and AJAX debugging – so this was the feature I was mostly looking to emulate.

Well, I have it, and you can too!

First, add the following to your php.ini:

; for windows use zend_extension_ts=php_xdebug.dll
zend_extension=/path/to/xdebug.so
xdebug.remote_enable=1
xdebug.remote_handler=dbgp 
xdebug.remote_mode=req
; for servers not on localhost, put in your network/public IP here
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000 ; Choose a port

Then, in Komodo, bring up the Preferences, and go to Debugger > Connection. Choose “a specific port” and set it to the port in xdebug.remote_port above.

Finally, just append ?XDEBUG_SESSION_START=1 to the URL in question and it will be passed through to Komodo!

This is just the first step, it doesn’t help with forms and such, but maybe someone else can work from here? :-)

Oh, and it works in all browsers :-D

– Davey

P.S.
Debug in Komodo bookmarklet will smartly append the XDEBUG_SESSION_START.

Update: As Derick points out in the comments, the Firefox extension found here will do an even better job than the bookmarklet as it will also allow you to stop the debugger from being called. Just click the icon in the status bar, and refresh or otherwise make a new HTTP request. The debugger will be called from then on until you click the icon again. Also as it’s cookie based, it will work for AJAX requests too :-)