尽管禁用了remote_autostart,Xdebug仍可为所有cli命令运行 [英] Xdebug runs for all cli commands despite remote_autostart being disabled

查看:51
本文介绍了尽管禁用了remote_autostart,Xdebug仍可为所有cli命令运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在没有完全禁用php.ini的Xdebug的情况下,我目前无法停止为所有cli命令运行Xdebug.以前,如果需要通过cli调试,我会切换remote_autostart启用.我的问题尤其是引起作曲家的问题,实际上使其无法运行.Composer声称如果Composer看到正在运行,则应该在不运行Xdebug的情况下重新启动它,这可能是从composer 1.3版开始修复的,但是我使用的是Composer 1.7.3.

Without completely disabling Xdebug from the php.ini I'm currently unable to stop Xdebug from running for all cli commands. Previously I would toggle remote_autostart to enable if I needed to debug through cli. My problem is in particular causing issues with composer, effectively making it unrunnable. Composer claim that composer should restart without Xdebug running if they see it is running, this is supposedly fixed from composer version 1.3 forward, but I'm using composer 1.7.3.

这是在我的高山PHP-FPM docker容器中运行的,但这并没有真正的作用.这个问题以前也曾由流浪者内部的一位同事经历过,因此如果需要,我也可以获取他的环境详细信息.

This is running inside my alpine PHP-FPM docker container but that shouldn't really make a difference. This issue has previously been experienced by a co-worker inside vagrant too so I can get his environment details too if needed.

php.ini Xdebug设置:

php.ini Xdebug settings which I set myself:

zend_extension=/var/www/html/xdebug/modules/xdebug.so
xdebug.remote_enable=1
xdebug.remote_port=9000
xdebug.show_local_vars=0
xdebug.var_display_max_data=10000
xdebug.var_display_max_depth=20
xdebug.show_exception_trace=0
#xdebug.remote_autostart=1
xdebug.remote_host=172.20.0.1
xdebug.idekey="PHPSTORM"
xdebug.remote_log=/srv/www/var/log/xdebug.log

php -i |grep'xdebug'输出:

xdebug
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 => Off => Off
xdebug.remote_connect_back => Off => Off
xdebug.remote_cookie_expire_time => 3600 => 3600
xdebug.remote_enable => On => On
xdebug.remote_handler => dbgp => dbgp
xdebug.remote_host => 172.20.0.1 => 172.20.0.1
xdebug.remote_log => /srv/www/var/log/xdebug.log => /srv/www/var/log/xdebug.log
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 => 10000 => 10000
xdebug.var_display_max_depth => 20 => 20

Docker cli bash变量:

Docker cli bash variables:

export XDEBUG_CONFIG="idekey=PHPSTORM";
export PHP_IDE_CONFIG="serverName=docker";

建立cli连接时的Xdebug日志:

Xdebug log when making cli connection:

Log opened at 2018-11-08 10:53:30
I: Connecting to configured address/port: 172.20.0.1:9000.
I: Connected to client. :-)
-> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/
xdebug" fileuri="file:///srv/www/pi.php" language="PHP" xdebug:language_version
="7.1.23" protocol_version="1.0" appid="863" idekey="PHPSTORM"><engine version=
"2.6.1"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><
url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2
018 by Derick Rethans]]></copyright></init>

推荐答案

未记录的行为

XDEBUG_CONFIG 环境变量具有导致Xdebug在每次执行时运行的不良效果,如本文底部所述. https://www.larrykagan.com/xdebug-on-docker/

XDEBUG_CONFIG environment variable has the undesired effect of causing Xdebug to run on every execution as described at the bottom of this article. https://www.larrykagan.com/xdebug-on-docker/

对我来说,解决方案是停止使用 export XDEBUG_CONFIG ="ide = PHPSTORM" ,因为该设置已经在我的ini中了.

For me the solution was just to stop using export XDEBUG_CONFIG="ide=PHPSTORM" as that setting is already in my ini anyway.

这篇关于尽管禁用了remote_autostart,Xdebug仍可为所有cli命令运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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