What is the best way to debug PHP with Eclipse? Specifically, I'm trying to work through some issues on a Drupal 6 installation.
I like Eclipse's debugging for Java. Is there a way to do the same for PHP?
I've never used Eclipse to develop in JAVA, but if you are asking about a graphical debugger that allows to set up breakpoints, go through the current stack trace, see content of variables, and all that, there is (at least one) a solution:
You can use the Xdebug extension, and Eclipse PDT as IDE : the second one is able to use the first one as debugger, and provides an interface for it -- kind of what you might expect if you have used a visual debugger in other languages/IDE.
I've used this combination a couple of times with Drupal, to see what was executed, in which order, how, and all that (not easy to get "by hand", with the hooks mecanism), and it definitly works pretty well.
There are tutorials available on the net that explain how to setup both of those to get the debugger working. For instance :
And here is a screenshot of what it can look like (here, I've set a breakpoint somewhere is the backoffice of Dotclear) :
(source: pascal-martin.fr)
(In theory, clicking on the image should get you to a bigger version)
The icons on top of the windows will allow you to do stuff like :
And you can also
I've also heard that Eclipse PDT can use the Zend Debugger extension instead of Xdebug ; but I've never tried this one.
You Can add this code in php.in file for enabling debugger.
[XDebug]
zend_extension = "D:\opt\lampp\php\ext\php_xdebug.dll"
xdebug.remote_enable=On
xdebug.remote_autostart=On
xdebug.remote_handler=dbgp
xdebug.remote_host="localhost"
xdebug.remote_port=9000
xdebug.remote_mode=req
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With