使用 Eclipse 远程调试 PHP

发布于 2024-08-19 23:40:34 字数 139 浏览 7 评论 0原文

我是一名自学新手,尝试在我的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

凌乱心跳 2024-08-26 23:40:34

虽然我只使用过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.

︶ ̄淡然 2024-08-26 23:40:34
  1. 虽然肯定存在远程调试的情况,但您应该始终在本地工作然后上传。除了最微小的更改之外的任何内容都应该在本地测试,然后推送到服务器 - 有时直接生产,有时测试服务器...
  2. 是的 Eclipse 支持使用 Xdebug 进行远程调试以及来自 Zend Debugger 的远程调试也请查看 Justin 的链接作为 Zend 调试器 的这个。我认为 Zend 与 pdt+deps 和 Zend 调试器合二为一 - 当然,您仍然需要在服务器上设置扩展(注意链接适用于 Windows 上的设置,但过程应该类似)。
  3. 强制性“Ewww GoDaddy”:-)
  1. While there is definitely a case for remote debugging you should always be working locally and then uploading. Anything except the most minor of changes should be done locally tested then pushed to a server - sometimes production directly, sometimes a testing server...
  2. Yes Eclipse supports remote debugging with Xdebug as well as the one from Zend Debugger check out Justin's links as well as This one for Zend Debugger. I think Zend has an all in one with pdt+deps and Zend Debugger - ofcourse you still need to set up the extension on the server (note link is for setup on windows but hte process should be similar).
  3. Obligatory "Ewww GoDaddy" :-)
奶茶白久 2024-08-26 23:40:34

如果 Web 服务器安装了 XDebug,那么您可以使用它进行调试。 在 google 中搜索它 会得到相当多的有关如何做的文章。

就我个人而言,我正在使用 CodeIgniter。我使用 FirePHPPQP。养成编写良好缩进代码的习惯。您可能会发现您的代码在语法和逻辑上的错误都更少,并且将来更容易维护。使用一致的空白,制表符或空格。使用一致的括号样式。当您重新阅读它以查找错误或稍后添加更多功能时,它将使您免于头痛。

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.

深居我梦 2024-08-26 23:40:34

我从来不需要在 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/

入画浅相思 2024-08-26 23:40:34

据我所知,这在 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文