我将 eclipse-pdt 与 xdebug 和 apache 结合使用已经一年多了,没有出现任何问题。一切都完美无缺,我可以在 eclipse 中进行我想要的所有交互式调试(使用我自己的机器作为服务器)。
现在我从 apache 切换到 nginx(因此 PHP 现在不是作为 Apache 服务而是作为 fast-cgi 运行) 我找不到一种方法来配置 eclipse 以与 xdebug 很好地协同工作.我不确定问题出在 xdebug 还是 eclipse(或两者)上。
在 eclipse 配置中,我已经将对 PHP 配置文件的引用更改为 /etc/php5/cli/php.ini
。
尝试使用 php.ini 版本 1
使用以下php.ini
文件
zend_extension=/usr/lib/php5/20060613/xdebug.so
- 我看到 xdebug 正在运行(例如,如果我执行
var_dump()
,我会得到它的 xdebug 版本,而不是普通的 PHP 版本) - 我无法从 eclipse 中进行交互式调试:浏览器打开并使用包含
...?XDEBUG_SESSION_START=ECLIPSE_DBGP&KEY=...
的典型 URL 完全加载页面,但是程序执行不会在断点处停止 - 在 eclipse 的右下角,我看到一条可疑消息:“Launching =put_the_name_of_my_project_here=: 57%” 与“刷新工作区” 交替出现。
尝试使用 php.ini 版本 2
如果我使用这个文件的其他版本(在我切换到 nginx 之前它一直有效):
zend_extension=/usr/lib/php5/20060613/xdebug.so
xdebug.remote_enable=On
xdebug.remote_autostart=On
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_mode=req
我根本无法访问我网站的任何页面。
PS:我机器上的附加数据: - 操作系统: GNU/Linux - Ubuntu 9.10 64 位。 - PHP: 5.2.10-2ubuntu6.3 with Suhosin-Patch 0.9.7; Zend Engine v2.2.0,版权所有 (c) 1998-2009 Zend Technologies with Xdebug v2.0.4 - Eclipse:查看屏幕截图。
最佳答案
xdebug 和 FastCGI 使用相同的默认端口 (9000)。像这样在 php.ini 文件中更改 XDebug 的端口:
xdebug.remote_port=9001
并更新您的 IDE 设置以使用 9001。
关于php - 使用 PHP fastcgi 和 eclipse 配置 Xdebug?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1868568/