Xdebug-命令不可用 [英] Xdebug - command is not available

查看:80
本文介绍了Xdebug-命令不可用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在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与调试器引擎进一步进行交互(例如,收集性能数据或使用其他扩展命令).

因此,调试器在到达第一个断点(在第一行上设置)之前停止.

这是服务器配置的问题吗?

解决方案

您应该转到php.ini并删除这样的一行

extension=php_xdebug-...


此行是如何创建的.

您将xdebug的文件放入这样的PHP扩展路径中

.../php5.X.XX/ext/

现在您可以通过任何_AMP UI工具(例如WAMP,XAMPP等)打开此PHP扩展.


为避免这种不幸的不幸,您必须将Xdebug文件放入

.../php5.X.XX/zend_ext/

这将使Xdebug对任何_AMP工具都隐藏起来.

还要更正您的zend_extension参数.

zend_extension = .../php5.X.XX/ext/php_xdebug-...

zend_extension = .../php5.X.XX/zend_ext/php_xdebug-...

这是它的常见默认路径.


请记住!
使用PHPStorm,Eclipse,Zend等,您可能应该考虑更正两个php.ini文件.

您的Web服务器的第一个.通常在Apache文件夹下

...\Apache2.X.XX\bin\

第二个用于直接PHP脚本调试.它位于PHP托管文件夹中:

...\php\php5.X.XX\

I'm debugging remotely my project in PhpStorm. IDE shows 'Connected' for a moment and immediately goes into 'Waiting for incoming connection...'

Below is Xdebug log from this session

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>
"

According to Xdebug documentation status "stopping" is 'State after completion of code execution. This typically happens at the end of code execution, allowing the IDE to further interact with the debugger engine (for example, to collect performance data, or use other extended commands).'

So my debugger stops before reaching first breakpoint (set on first line).

Could it be a question of server configuration?

解决方案

You should go to php.ini and delete a line like this

extension=php_xdebug-...


How did this line was created.

You put a xdebug's file into PHP extensions path like this

.../php5.X.XX/ext/

Now you may turn on this PHP extension by any _AMP UI tools like WAMP, XAMPP etc.


To prevent this painful misfortune you must put the Xdebug file into

.../php5.X.XX/zend_ext/

It'll make Xdebug hidden from any _AMP tool.

And correct your zend_extension parameter too.

zend_extension = .../php5.X.XX/ext/php_xdebug-...

to

zend_extension = .../php5.X.XX/zend_ext/php_xdebug-...

It's common default path for it.


Please, remember!
With PHPStorm, Eclipse, Zend etc., possibly you should consider to correct two php.ini files.

The first one for your web server. Commonly under Apache folder

...\Apache2.X.XX\bin\

The second one is for the direct PHP-script debugging. It lies in the PHP hosting folder:

...\php\php5.X.XX\

这篇关于Xdebug-命令不可用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆