【问题标题】:xdebug breakpoint failxdebug 断点失败
【发布时间】:2017-07-28 02:58:16
【问题描述】:

庆祝以通常的方式设置新的测试服务器盒 - 寻求帮助以使 xdebug 工作。

服务器: Ubuntu 服务器 16.10 / Nginx / PHP 7 Xdebug 设置的要求为http://php-built.com/installing-xdebug-for-php7/ 并显示在 phpinfo 上

我**:

这些是当前尝试的设置

[xdebug]
zend_extension="/usr/lib/php/20151012/xdebug.so"
xdebug.remote_enable=true
xdebug.remote_host=192.168.0.201
xdebug.remote_port=10000 (port #9000 is usually occupied by FPM, so I recommend to use a differen$
xdebug.remote_autostart=1
xdebug.idekey=netbeans-xdebug

客户: Windows 10 / Netbeans 监听 10000 端口

日志:

Log opened at 2017-03-15 17:23:49
I: Connecting to configured address/port: 192.168.0.201:10000.
I: Connected to client. :-)
-> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///var/www/usr-datadimension/datadimension/sitefiles/public/index.php" language="PHP" xdebug:language_version="7.0.15-0ubuntu0.16.10.4" protocol_version="1.0" appid="19891" idekey="netbeans-xdebug"><engine version="2.5.1"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2017 by Derick Rethans]]></copyright></init>

<- feature_set -i 28 -n show_hidden -v 1
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="28" feature="show_hidden" success="1"></response>

<- feature_set -i 29 -n max_depth -v 3
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="29" feature="max_depth" success="1"></response>

<- feature_set -i 30 -n max_children -v 30
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="30" feature="max_children" success="1"></response>

<- feature_set -i 31 -n max_data -v 2048
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="31" feature="max_data" success="1"></response>

<- breakpoint_set -i 32 -t line -s enabled -f file://TESTSERVERSHARE/sitefiles/app/ControllerLibrary/Controllers/RootController_c.php -n 31
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="32" state="enabled" id="198910001"></response>

<- run -i 34
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="run" transaction_id="34" status="stopping" reason="ok"></response>

Log closed at 2017-03-15 17:23:50

我已经根据下面一些有用的 cmets 进行了编辑,但他们没有提供解决方案,尽管我可以看到 xdebug 指出日志中有连接。

有趣的是,当我选择“在第一行停止”时,“继续”图标显示为绿色,执行似乎停止,但我不知道在哪里。断点仍然被忽略,所以看起来 Netbeans 正在部分识别 xdebug。 这是同时使用 Chrome 和 Firefox。

请帮助让 xdebug 和 netbeans 交谈。

【问题讨论】:

  • 1) 防火墙? 2) NetBeans 是否真的在 TCP 9000 端口上侦听(也许您忘记启用侦听器(例如,在 PhpStorm 中有专门的按钮))?使用 netstat 或类似工具检查它。 3) php.ini 的完整 xdebug 设置是什么?日志显示 "Checking remote connect back address" ...但我没有看到相应的配置行(这意味着 - 您只显示了其中的一部分)。 4) 它是什么 IP -- 192.168.5.17 -- 仔细检查它是否是正确的 IP(必须是运行 NetBeans 的计算机的 IP,从该 Ubuntu 看)
  • @LazyOne - 是的,尝试了所有显而易见的方法。 IP 只是一个 192.168.5 范围的本地 IP。 IDE 在此处显示为正在侦听。
  • 你的服务器和你的系统在同一个网络上吗?你在这里使用公共IP。所以请仔细检查那些。并形成交叉检查,您可以通过您的系统访问192.168.0.201:10000吗?
  • @chudasamachirag 您在哪里读取公共 IP - 这些是同一 LAN 上的地址?
  • 据我所知 192.168.{0-9}.{0-9} 建议使用本地网络,我曾经这样做

标签: php netbeans xdebug


【解决方案1】:

我以前从未在 Netbeans 上设置过此设置,但从查看 Eclipse 上报告的类似问题看来,此设置需要将 Project properties &gt; Source &gt; Web Root 设置为 Nginx 提供的公共目录。 断点现在可以正常工作了。

【讨论】:

    【解决方案2】:

    我正在使用浏览器插件: 最简单的xdebug,它也适用于chrome浏览器(https://addons.mozilla.org/En-us/firefox/addon/the-easiest-xdebug/

    它有关于如何启动 xdebug 的文档

    我成功地让它在 Netbeans、Atom.io、Ms Code 上运行。这很容易。

    【讨论】:

    • 这看起来很有希望,抱歉我没有机会测试这个但会做
    • 一旦开始,就可以在任何平台或IDE上轻松设置xdebug
    • 在 Visual Studio Code 中,有一个服务器端根目录位置的设置,我想 IDE 知道如何将 url 映射到文件,也许这样的事情是你的问题。看起来像这样,因为它设法连接到客户端,但不响应断点
    【解决方案3】:

    您可以将这些设置添加到 ini 并尝试一下吗?

    xdebug.remote_connect_back=1
    xdebug.collect_includes=on
    xdebug.extended_info=1
    xdebug.show_local_vars=1
    xdebug.show_mem_delta=1
    xdebug.max_nesting_level=200
    

    希望端口 10000 被允许

    【讨论】:

    • 这个好像没什么区别,日志输出同上(时间戳除外)
    猜你喜欢
    • 1970-01-01
    • 2015-10-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-06-27
    相关资源
    最近更新 更多