ICode9

精准搜索请尝试: 精确搜索
首页 > 编程语言> 文章详细

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

2019-09-28 14:32:05  阅读:334  来源: 互联网

标签:php phpstorm xdebug


我为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

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

我还验证了远程调试环境.都很好. 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

解决方法:

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

This answer到另一个问题为我解决了问题,但我想在我自己的答案中添加更多细节.

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

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

XDEBUG NOT LOADED AS ZEND EXTENSION

XDEBUG NOT LOADED AS ZEND EXTENSION

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

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

enter image description here

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

zend_extension = "/usr/local/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so"

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

extension=xdebug.so

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

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

PhpStorm xdebug server variables error

Cannot accept external Xdebug connection
Cannot evaluate expression 'isset($_SERVER['PHP_IDE_CONFIG'])'

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

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

顺便说一句,这就是我在xdebug的本地php.ini中所拥有的:

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

标签:php,phpstorm,xdebug
来源: https://codeday.me/bug/20190928/1827944.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有