Xdebug Problems with Eclipse PHP/PDT



我在将 PHP Xdebug 与更高版本的 Eclipse 提供的 PHP 内部服务器一起使用时遇到了一些困难。我正在运行 Eclipse for PHP Developers 版本:Oxygen.3a Release (4.7.3a)。有趣的是,Xdebug在Apache 2上工作得很好,但不能在内部PHP服务器上工作。

请注意,PHP 内部服务器正在运行。我可以使用"运行方式 – 1在服务器上运行"来运行phpinfo PHP脚本和helloworld PHP脚本。在这些情况下,PHP 内部服务器以预期的操作数启动。Linuxps命令返回:

/usr/bin/php -S 127.0.0.1:8000 -t /home/peter/eclipse-workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/htdocs
  • 请注意,端口8000用于启动内部 PHP 服务器(据我所知是正确的),并且没有指定–n操作数。这会导致处理/etc/php/7.0/cli/php.ini文件(尽我所能正确
  • )。
  • 请注意,端口80最初用于运行此服务器。当然,端口 80 仅限于根应用程序。需要更改端口 8000 才能启动内部 PHP 服务器。
  • 另请注意,需要选中"使用系统默认 php.ini 配置"并清除 PHP 可执行文件首选项中的 PHP ini 文件(可选)字段才能摆脱–n操作数。

另请注意,我在"运行方式"和"调试身份"之间切换时遇到了一些困难。在某些情况下,我会收到一条消息,显示所需的端口 (8000) 已在使用中。但是,到目前为止,我还没有找到重现此问题的方法。

使用上述过程,调试内部 PHP 服务器在没有–n操作数的情况下启动,并且正在处理 php.cli 文件。Linuxps命令返回:

/usr/bin/php -S 127.0.0.1:17278 -t /home/peter/eclipse-workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/htdocs

一个问题是为什么指定端口 17278,而不是预期的端口 (8000)。运行phpinfo()显示 Xdebug 似乎已安装在调试内部 Web 服务器中。一些设置包括:

xdebug support – enabled
IDE Key – peter (my userid on this machine)
DBGp – Common DeBuGger Protocol - $Revision: 1.145 $
xdebug.remote.enable – on
xdebug.remote.port – 9000

我试图调试helloworld.php.控制台包含以下两条消息。第一个显示 404 代码。第二个显示 200 代码:

[2018 年 4 月 22 日星期日 17:36:20] 127.0.0.1:50358 [404]:/?start_debug=1&debug_fastfile=1&use_remote=1&ZRayDisable=1&send_sess_end=1 &debug_session_id=1003&debug_start_session=1&debug_port=10137 - 没有这样的文件或目录

[2018年4月22日星期日 17:36:20] 127.0.0.1:50362 [200]:/Server-docroou/helloworld.php?start_debug=1&debug_fastfile=1&use_remote=1&ZRayDisable=1&send_sess_end=1 &debug_session_id=1003&debug_start_session=1&debug_port=10137

请注意,调试端口指定为10137。也许这是导致问题的原因。端口 10137 通常由我没有使用的 Zend 调试器使用。

有人有什么想法吗?提前谢谢你。

PDT 6.0 中修复的问题:https://bugs.eclipse.org/bugs/show_bug.cgi?id=533928 ;)

最新更新