PhpStorm没有收到xdebug连接:PhpStorm事件日志:无法计算表达式'isset($ _ SERVER ['PHP_IDE_CONFIG'])'

Osa*_*ama 22 php xdebug phpstorm

我为PhpStorm和xdebug配置了所有工作,我正在运行Ubuntu 14.04.

没有建立回IDE的连接,我在IDE事件Log中得到了这个

无法接受外部Xdebug连接:无法计算表达式'isset($ _ SERVER ['PHP_IDE_CONFIG'])' - Osama Salama 13分钟前

我将把我在不同地方配置的配置值放在一起.因为我无法找出问题所在

php.ini中

zend_extension = /usr/lib/php5/20121212/xdebug.so
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_connect_back = 1
xdebug.remote_autostart = 1
xdebug.remote_log=xxx/xdebug.log
xdebug.IDE_key=PHPSTORM
Run Code Online (Sandbox Code Playgroud)

PHP信息

Xdebug的

xdebug support  enabled
Version 2.3.1
IDE Key PHPSTORM

Supported protocols Revision
DBGp - Common DeBuGger Protocol $Revision: 1.145 $

Directive   Local Value Master Value

xdebug.auto_trace   Off Off
xdebug.cli_color    0   0
xdebug.collect_assignments  Off Off
xdebug.collect_includes On  On
xdebug.collect_params   0   0
xdebug.collect_return   Off Off
xdebug.collect_vars Off Off
xdebug.coverage_enable  On  On
xdebug.default_enable   On  On
xdebug.dump.COOKIE  no value    no value
xdebug.dump.ENV no value    no value
xdebug.dump.FILES   no value    no value
xdebug.dump.GET no value    no value
xdebug.dump.POST    no value    no value
xdebug.dump.REQUEST no value    no value
xdebug.dump.SERVER  no value    no value
xdebug.dump.SESSION no value    no value
xdebug.dump_globals On  On
xdebug.dump_once    On  On
xdebug.dump_undefined   Off Off
xdebug.extended_info    On  On
xdebug.file_link_format no value    no value
xdebug.force_display_errors Off Off
xdebug.force_error_reporting    0   0
xdebug.halt_level   0   0
xdebug.idekey   no value    no value
xdebug.max_nesting_level    256 256
xdebug.max_stack_frames -1  -1
xdebug.overload_var_dump    On  On
xdebug.profiler_aggregate   Off Off
xdebug.profiler_append  Off Off
xdebug.profiler_enable  Off Off
xdebug.profiler_enable_trigger  Off Off
xdebug.profiler_enable_trigger_value    no value    no value
xdebug.profiler_output_dir  /tmp    /tmp
xdebug.profiler_output_name cachegrind.out.%p   cachegrind.out.%p
xdebug.remote_autostart On  On
xdebug.remote_connect_back  On  On
xdebug.remote_cookie_expire_time    3600    3600
xdebug.remote_enable    On  On
xdebug.remote_handler   dbgp    dbgp
xdebug.remote_host  127.0.0.1   127.0.0.1
xdebug.remote_log   /home/nautilus/Desktop/xdebug.log   /home/nautilus/Desktop/xdebug.log
xdebug.remote_mode  req req
xdebug.remote_port  9000    9000
xdebug.scream   Off Off
xdebug.show_exception_trace Off Off
xdebug.show_local_vars  Off Off
xdebug.show_mem_delta   Off Off
xdebug.trace_enable_trigger Off Off
xdebug.trace_enable_trigger_value   no value    no value
xdebug.trace_format 0   0
xdebug.trace_options    0   0
xdebug.trace_output_dir /tmp    /tmp
xdebug.trace_output_name    trace.%c    trace.%c
xdebug.var_display_max_children 128 128
xdebug.var_display_max_data 512 512
xdebug.var_display_max_depth    3   3
Run Code Online (Sandbox Code Playgroud)

我还验证了远程调试环境.都很好. https://www.jetbrains.com/phpstorm/help/validating-the-configuration-of-a-debugging-engine.html也很好.

最后一种可能的方法是xdebug日志文件:

Log opened at 2015-03-13 14:39:01
I: Checking remote connect back address.
W: Remote address not found, connecting to configured address/port: 127.0.0.1:9000. :-|
I: Connected to client. :-)
-> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="dbgp://stdin" language="PHP" protocol_version="1.0" appid="4474"><engine version="2.3.1"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2015 by Derick Rethans]]></copyright></init>
<- feature_set -i 1 -n show_hidden -v 1
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="1" feature="show_hidden" success="1"></response>
<- feature_set -i 2 -n max_depth -v 1
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="2" feature="max_depth" success="1"></response>
<- feature_set -i 3 -n max_children -v 100
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="3" feature="max_children" success="1"></response>
<- status -i 4
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="status" transaction_id="4" status="starting" reason="ok"></response>
<- step_into -i 5
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="5" status="stopping" reason="ok"></response>
<- eval -i 6 -- aXNzZXQoJF9TRVJWRVJbJ1BIUF9JREVfQ09ORklHJ10p
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="eval" transaction_id="6"><error code="5"><message><![CDATA[command is not available]]></message></error></response>
Log closed at 2015-03-13 14:39:01
Run Code Online (Sandbox Code Playgroud)

But*_*kus 19

我在PhpStorm中遇到与OP完全相同的错误.

对不同问题的这个答案解决了我的问题,但我想在我自己的答案中添加更多细节.

主要问题是xdebug加载不当.其他答案中提到的服务器映射问题对我来说不是问题.

如果您加载phpinfo()页面并找到xdebug部分,您会看到:

XDEBUG未加载为ZEND EXTENSION

XDEBUG未加载为ZEND EXTENSION

然后你必须在尝试其他任何事情之前解决这个问题!但是,如果你有多个php.ini文件,有时这可能需要一些工作来追踪.

同样在你的phpinfo()页面中,搜索"php.ini",(它应该在顶部附近)并看到你的"配置文件(php.ini)路径"和你的"加载配置文件".那些是您的xdebug可能正在加载的地方.

在此输入图像描述

在我的例子中,我正确地将它作为Zend扩展名加载到/usr/local/lib/php.ini中的主配置文件中,如下所示:

zend_extension = "/usr/local/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so"
Run Code Online (Sandbox Code Playgroud)

但是在我的/home/someuser/public_html/php.ini中的Loaded配置文件中,我错误地加载了这样:

extension=xdebug.so
Run Code Online (Sandbox Code Playgroud)

修好之后,我再次使用PhpStorm进行远程调试.

作为旁注,我在PhpStorm中看到的第一个错误与OP提到的完全相同,这就是它的样子:

PhpStorm xdebug服务器变量错误

Cannot accept external Xdebug connection
Cannot evaluate expression 'isset($_SERVER['PHP_IDE_CONFIG'])'
Run Code Online (Sandbox Code Playgroud)

(起初我认为,因为扩展没有正确加载,PhpStorm无法在服务器上执行PHP代码.但是现在我认为如果配置了解释器,PhpStorm只执行php代码,这对于调试来说不是必需的.对于调试,PhpStorm只需要xdebug连接和正确的路径映射.)

后来,我在服务器上的xdebug日志中发现"命令不可用"错误,这使我找到了解决方案.

顺便说一句,这就是我在php.inixdebug 当地的情况:

;extension=xdebug.so <- this is the bad line commented!
zend_extension = "/usr/local/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so"

xdebug.remote_enable=true
xdebug.remote_port="9000"
xdebug.profiler_enable=1
xdebug.profiler_output_dir="/tmp/xdebug-someuser/"
xdebug.profile_enable_trigger=1
xdebug.trace_enable_trigger=1
xdebug.idekey="PHPSTORM"
xdebug.remote_log="var/log/xdebug/xlog"
Run Code Online (Sandbox Code Playgroud)

  • 我有同样的问题,我已经配置为 zend 扩展,但这个问题仍然发生 (3认同)

小智 8

最近我有尝试使用调试同样的问题PHPStormnginxphp-fpm,于我而言这是不相关的xdebug,nginx或者php-fpm config,它是在路径映射phpstorm是人失踪.

最初PHPStorm会在无法将服务器上的文件映射到本地源文件时通知您,但是如果它具有映射到第一个文件的映射(通常index.php或某些此类)但它无法映射稍后使用的文件(在我的情况下)这是使用composer的项目的供应商目录中的自动加载器)然后PHPStorm将无法进一步调试,调试将停止.

为了纠正这种情况,PHPStormsettings/Languages & Frameworks/PHP/Servers确保项目的根目录正确映射到服务器上的对应目录.

PHPStorm 然后应该能够映射项目中的所有文件并继续调试.

我希望这有帮助.