Xdebug,无法接受外部xdebug连接。本地值覆盖主文件

时间:2018-06-15 08:57:13

标签: php vagrant phpstorm xdebug

我一直在尝试为PHP CLI命令设置xdebug。我已经让它适用于调试Apache 2(浏览器/ API连接)。服务器通过Vagrant设置。所以我将一些xdebug设置复制到我的cli/php.ini

[xdebug]
zend_extension=xdebug.so
xdebug.remote_connect_back=1
xdebug.remote_enable=1
xdebug.remote_autostart=1
xdebug.remote_port=9000
xdebug.remote_host=10.0.2.2
xdebug.extended_info=1
xdebug.idekey="PHPSTORM"

我在IDE(PhpStorm)中设置了一堆地址

enter image description here

现在,当我尝试使用它时,大部分时间都没有发生任何事情,但是我昨天第一次尝试它并且今天早上的第一件事它给了我留言

  

无法接受外部Xdebug连接:无法计算表达式'isset($ _ SERVER ['PHP_IDE_CONFIG'])'。

我还尝试向我的代码添加phpinfo()调用,然后从终端将其调用到grep xdebug。这给了我以下显示本地值=>掌握价值。我担心xdebug.remote_host值似乎覆盖了'localhost'的本地值,但我不知道这是怎么回事。

xdebug support => enabled
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.filename_format => no value => no value
xdebug.force_display_errors => Off => Off
xdebug.force_error_reporting => 0 => 0
xdebug.gc_stats_enable => Off => Off
xdebug.gc_stats_output_dir => /tmp => /tmp
xdebug.gc_stats_output_name => gcstats.%p => gcstats.%p
xdebug.halt_level => 0 => 0
xdebug.idekey => PHPSTORM => PHPSTORM
xdebug.max_nesting_level => 256 => 256
xdebug.max_stack_frames => -1 => -1
xdebug.overload_var_dump => 2 => 2
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_addr_header => no value => no value
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 => localhost => 10.0.2.2
xdebug.remote_log => no value => no value
xdebug.remote_mode => req => req
xdebug.remote_port => 9000 => 9000
xdebug.remote_timeout => 200 => 200
xdebug.scream => Off => Off
xdebug.show_error_trace => 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

感谢您的帮助

1 个答案:

答案 0 :(得分:0)

所以修复就像为我运行export XDEBUG_CONFIG="remote_host=10.0.2.2"一样简单,这解决了我对remote_host

的不正确的本地值