【发布时间】:2013-07-03 07:05:57
【问题描述】:
我正在 PhpStorm 中远程调试我的项目。 IDE 显示“已连接”片刻,然后立即进入“等待传入连接...”
以下是本次会议的 Xdebug 日志
I: Connecting to configured address/port: X.x.x.x:9000.
I: Connected to client. :-)
> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///xxx/info.php" language="PHP" protocol_version="1.0" appid="4365" idekey="10594"><engine version="2.2.2"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATAhttp://xdebug.org]></url><copyright><![CDATA[Copyright (c) 2002-2013 by Derick Rethans]]></copyright></init>
<- feature_set -i 0 -n show_hidden -v 1
> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="0" feature="show_hidden" success="1"></response>
<- feature_set -i 1 -n max_depth -v 1
> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="1" feature="max_depth" success="1"></response>
<- feature_set -i 2 -n max_children -v 100
> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="2" feature="max_children" success="1"></response>
<- status -i 3
> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="status" transaction_id="3" status="starting" reason="ok"></response>
<- step_into -i 4
> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="4" status="stopping" reason="ok"></response>
<- breakpoint_set -i 5 -t line -f file://xxx/info.php -n 3
> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="5"><error code="5"><message><![CDATA[command is not available]]></message></error></response>
"
根据 Xdebug 文档状态“停止”是 '代码执行完成后的状态。这通常发生在代码执行结束时,允许 IDE 进一步与调试器引擎交互(例如,收集性能数据,或使用其他扩展命令)。'
所以我的调试器在到达第一个断点(设置在第一行)之前停止。
会不会是服务器配置的问题?
【问题讨论】:
-
1) 调试是否仅在某些文件中有效.. 还是根本不起作用(在此项目中)? 2) 这是远程项目吗(xdebug 和 IDE 在不同的/虚拟机上)? 3) 是否使用了符号路径?现在可能是因为路径映射配置错误(A)xdebug 适用于去链接/解析/真实路径,而 IDE 可能适用于符号链接的路径和 B)本地路径与远程不同); 4) xdebug 根本无法在某些断点上中断(例如,多行定义、没有大括号的循环体等)——尝试将其设置在基本的简单行上;
-
5) 看看放
xdebug_break();是否会做任何不同的事情(以这种方式强制断点)。除此之外——看看 IDE 方面发生了什么——按照这些说明收集更详细的 php 调试日志:devnet.jetbrains.com/docs/DOC-1202 -
1) 此服务器根本无法调试。 2)它在不同的机器上,我在 NAT 后面。 3) 是的,使用了符号路径。我想我在 PhpStorm 中添加了正确的路径映射(与我过去所做的相同)。 4) 我的脚本有 4 行