【问题标题】:Xdebug Problems with Eclipse PHP/PDTEclipse PHP/PDT 的 Xdebug 问题
【发布时间】:2023-04-04 17:46:01
【问题描述】:

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

请注意,PHP 内部服务器正在运行。我可以使用“Run As – 1Run on Server”来运行 phpinfo PHP 脚本和 helloworld PHP 脚本。在这些情况下,PHP 内部服务器使用预期的操作数启动。 Linux ps 命令返回:

/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 仅限于 root 应用程序。需要更改端口 8000 才能启动内部 PHP 服务器。
  • 另请注意,需要检查“使用系统默认 php.ini 配置”并清除 PHP 可执行文件首选项中的 PHP ini 文件(可选)字段,才能摆脱 –n 操作数。

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

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

/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。也许这是造成问题的原因。我没有使用的 Zend 调试器通常使用端口 10137。

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

【问题讨论】:

  • 谢谢 LazyOne。现在看起来好多了。
  • 我尝试调试 helloworld.php 时的控制台实际上有两条消息。第一个得到 404。第二个得到 200。见下文。
    [Sun Apr 22 17:36:20 2018] 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 - 没有这样的文件或目录 [Sun Apr 22 17:36:20 2018] 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
  • 我已经查看了当我尝试调试 helloworld.php 时出现的消息。操作数(debug_port=10137、ZRayDisable=1、debug_session_id=1003 等)都与 zend 相关。出于某种原因,PDT id 试图调用 zend 调试器,即使我没有使用 zend 调试器。
  • 在这种情况下——检查你看到 PHP Debugger 或 PHP Interpreter 的所有设置(对不起,我自己从未使用过 Eclipse,所以不知道它是如何在那里调用的)——也许这样的地方之一有 Zend选择了调试器而不是 Xdebug。

标签: php eclipse xdebug eclipse-pdt


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 2011-01-15
    • 1970-01-01
    • 2015-10-18
    • 2012-01-23
    • 1970-01-01
    • 2010-12-05
    • 2019-04-14
    • 2012-03-21
    • 1970-01-01
    相关资源
    最近更新 更多