PhpStorm没有接收到xdebug连接:PhpStorm事件日志:无法评估表达式'isset($ _ SERVER ['PHP_IDE_CONFIG'])' [英] PhpStorm is not receiving xdebug connections : PhpStorm event log : Cannot evaluate expression 'isset($_SERVER['PHP_IDE_CONFIG'])'

查看:83
本文介绍了PhpStorm没有接收到xdebug连接:PhpStorm事件日志:无法评估表达式'isset($ _ SERVER ['PHP_IDE_CONFIG'])'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我配置了所有使PhpStorm和xdebug正常工作的东西,我正在运行Ubuntu 14.04.

I configured everything for PhpStorm and xdebug to work, I'm running Ubuntu 14.04.

未建立回IDE的连接,这是在IDE事件日志中获得的

the connection back to the IDE is not established, and I get this in the IDE event Log

无法接受外部Xdebug连接:无法评估表达式'isset($ _ SERVER ['PHP_IDE_CONFIG'])'– 13年前的Osama Salama

我将在各个地方配置的配置值放在一起.由于我找不到问题所在

I'll put together configuration values I configured in various places. As I can't find out where is the problem

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中的错误完全相同.

I had the exact same error in PhpStorm as the OP.

针对另一个问题的答案为我解决了这个问题,但我想自己补充一点答案.

This answer to a different question solved the problem for me, but I would like to add more detail in my own answer.

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

The main issue was improperly loaded xdebug. The server mapping issues mentioned in other answers was not an issue for me.

如果加载phpinfo()页面并找到xdebug部分,则会看到以下内容:

If you load your phpinfo() page and find the xdebug section, and you see this:

XDEBUG未作为ZEND扩展名加载

XDEBUG NOT LOADED AS ZEND EXTENSION

然后,您必须先解决该问题,然后再尝试其他任何操作!但是有时候,如果您有多个php.ini文件,这可能需要一些工作来进行跟踪.

Then you have to fix that before you try anything else! But sometimes this can take some work to track down, if you have multiple php.ini files.

也可以在您的phpinfo()页面中搜索"php.ini"(它应该在顶部附近),并查看配置文件(php.ini)路径"和已加载的配置文件".这些就是您的xdebug可能要加载的地方.

Also in your phpinfo() page, search for "php.ini", (it should be right near the top) and see your "Configuration File (php.ini) Path", and your "Loaded Configuration File". Those are where your xdebug may be loading.

对于我来说,我将其作为Zend扩展名正确地加载到了/usr/local/lib/php.ini的主配置文件中,如下所示:

In my case, I correctly loaded it as a Zend extension in my main configuration file in /usr/local/lib/php.ini, like so:

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

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

But in my Loaded Configuration file in /home/someuser/public_html/php.ini, I had it incorrectly loaded like this:

extension=xdebug.so

修复此问题后,使用PhpStorm进行的远程调试对我来说再次有效.

After fixing that, remote debugging with PhpStorm is working again for me.

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

As a side note, the first error I saw in PhpStorm was the exact same one the OP mentions, and here is what it looks like:

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

(起初我以为,由于扩展名加载不正确,PhpStorm无法在服务器上执行PHP代码.但是现在我认为PhpStorm仅在配置了解释器的情况下才执行php代码.进行调试.对于调试,PhpStorm仅需要xdebug连接和正确的路径映射.)

( At first I thought that, because the extension was not loaded properly, PhpStorm was not able to execute PHP code on the server. But now I think PhpStorm only executes php code if you configured an interpreter, which isn't necessary for debugging. For debugging, PhpStorm just needs the xdebug connection and the correct path mappings.)

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

Later, I found the "Command is not available" error in the xdebug log on my server, which led me to the solution.

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

Here, by the way, is what I have in my local php.ini for xdebug:

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

这篇关于PhpStorm没有接收到xdebug连接:PhpStorm事件日志:无法评估表达式'isset($ _ SERVER ['PHP_IDE_CONFIG'])'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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