使用 Eclipse 远程调试 PHP
我是一名自学新手,尝试在我的 GoDaddy 托管服务器上调试 PHP。这个想法是否合理,或者我是否需要继续在本地进行所有开发并不断重新 ftp 上传更改?
有什么方法可以使用 eclipse 来单步调试并调试托管在第三方站点上的 php 脚本吗?
I'm a self-taught noobie, trying to debug PHP on my GoDaddy hosted server. Is this idea even rational, or do I need to continue to do all development locally and just continuously re-ftp upload the changes?
Is there some way that I can use eclipse to step through, and debug my php scripts that are hosted on a third party site?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
虽然我只使用过Netbeans和XDebug进行远程调试,但是使用Eclipse PDT和XDebug应该是可以的。请参阅:
不过,有一点需要注意。要配置 xdebug,您需要修改 php.ini 中的一些设置 - 我不确定这在托管服务器上是否可行。如果没有,您将需要有一个用于调试的本地服务器,并且需要为您的“生产”环境找到另一个解决方案。实际上,这可能不是一个坏主意,因为它将为您提供一个测试更改的好地方,而不会冒破坏实际站点上任何内容的风险。
另外,我建议您研究一下 Netbeans,如果没有其他原因,只是为了试验一下,看看它与 Eclipse 相比能做什么。一项不错的功能是,您可以将其设置为自动 ftp(或 scp)更改的文件到远程站点。因此,您可以进行一些代码更改,单击调试按钮,等待文件上传片刻后,您可以单步调试远程站点上的代码。
Although I have only used Netbeans and XDebug for remote debugging, it should be possible to use Eclipse PDT and XDebug. See:
One caveat, however. To configure xdebug you will need to modify some settings in php.ini - I am not sure if this will be possible on a hosted server. If not, you would need to have a local server that you use for debugging, and would need to figure out another solution for your "production" environment. Which may not be a bad idea, actually, as it would give you a good place to test your changes without risking breaking anything on your actual site.
Also, I recommend that you look into Netbeans, if for no other reason than to experiment and see what it can do compared to Eclipse. One nice feature is that you can set it up to automatically ftp (or scp) changed files to the remote site. So you can make some code changes, click the debug button, and after waiting a moment for your files to upload you can be stepping through code on the remote site.
如果 Web 服务器安装了 XDebug,那么您可以使用它进行调试。 在 google 中搜索它 会得到相当多的有关如何做的文章。
就我个人而言,我正在使用 CodeIgniter。我使用 FirePHP 和 PQP。养成编写良好缩进代码的习惯。您可能会发现您的代码在语法和逻辑上的错误都更少,并且将来更容易维护。使用一致的空白,制表符或空格。使用一致的括号样式。当您重新阅读它以查找错误或稍后添加更多功能时,它将使您免于头痛。
If the web server have XDebug installed, then you can do debugging with it. Searching for it in google yield a quite num of articles on how to do it.
Personally, I'm using CodeIgniter. I do debugging using FirePHP and PQP. Make a habit to write a good indented code. You might find your code have less bug, both syntax and logic, and easier to maintained in the future. Use a consistent white space, either tab or space. Use a consistent bracket style. It will save you from the headache when re-read it for bug or adding more feature later.
我从来不需要在 PHP 中进行一步一步的调试,但是当我确实需要调试时,我只是输出此时变量的字符串。
然而,我发现但又从未使用过的一件事是 FirePHP:
http://www.firephp.org/
I have never needed to do a step by step debug in PHP, but when I do need to debug I just output strings of the variables at that point.
However, one thing that I found, but again never used, was FirePHP:
http://www.firephp.org/
据我所知,这在 Eclipse 中是不可能的,但是在 NetBeans 中是可能的,但是正如 Nathan 所说,我从来没有真正需要远程调试任何 PHP 脚本。
As far as I'm aware, this is not possible in Eclipse, it is, however, possible in NetBeans, but as Nathan stated, I've never really needed to remote debug any of my PHP scripts.