用Eclipse调试PHP? [英] Debug PHP with Eclipse?

查看:188
本文介绍了用Eclipse调试PHP?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Eclipse调试PHP的最佳方法是什么?具体来说,我正在尝试解决Drupal 6安装中的一些问题。



我喜欢Eclipse的Java调试。有没有办法做同样的PHP?

解决方案

我从来没有使用Eclipse来开发JAVA,但如果你正在询问一个图形调试器,允许设置断点,通过当前堆栈跟踪,查看变量的内容,所有这些(至少有一个)解决方案:



您可以使用 Xdebug 扩展程序和 Eclipse PDT 作为IDE:第二个可以使用第一个作为调试器,并为其提供一个接口 - 一种你可能如果您使用其他语言/ IDE中的可视化调试器。



我已经将这个组合几次与Drupal一起使用,看看执行了什么



b



b



有教程可用o在网络中,解释如何设置这两个以使调试器工作。例如:







这里是一个截图它可以看起来像(这里,我在DotClear的后台设置了一个断点)




http://extern.pascal-martin.fr/so/eclipse-xdebug-debug-1.png



(理论上来说,点击图片可以让你进入更大的版本)





窗口顶部的图标将允许您执行以下操作:




  • 一步一步

  • 进/出功能/方法



您也可以




  • 查看变量的内容(屏幕右上方)

  • 有一个堆栈跟踪显示你在哪里(屏幕截图的左上角)

  • 当然,看到你是在代码(底部)





我也听说Eclipse PDT可以使用Zend Debugger扩展名的Xdebug;但我从来没有尝试过这个。


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) :

http://extern.pascal-martin.fr/so/eclipse-xdebug-debug-1.png

(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 :

  • step by step
  • step in / out of functions / methods

And you can also

  • see the content of variables (top right of the screenshot)
  • have a stack trace showing where you are (top left of the screen shot)
  • of course, see were you are in the code (bottom)


I've also heard that Eclipse PDT can use the Zend Debugger extension instead of Xdebug ; but I've never tried this one.

这篇关于用Eclipse调试PHP?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆