gpt4 book ai didi

php - 尽管禁用了 remote_autostart,Xdebug 仍为所有 cli 命令运行

转载 作者:行者123 更新时间:2023-12-04 21:09:22 25 4
gpt4 key购买 nike

如果没有从 php.ini 完全禁用 Xdebug,我目前无法阻止 Xdebug 为所有 cli 命令运行。以前,如果我需要通过 cli 进行调试,我会切换 remote_autostart 以启用。我的问题特别是导致 Composer 出现问题,有效地使其无法运行。 Composer 声称,如果 Composer 看到它正在运行,它应该在不运行 Xdebug 的情况下重新启动,这应该是从 Composer 1.3 版开始修复的,但我使用的是 Composer 1.7.3。

这是在我的 alpine PHP-FPM docker 容器中运行的,但这应该没什么区别。这个问题以前也被 vagrant 内部的一位同事遇到过,所以如果需要,我也可以获取他的环境详细信息。

我自己设置的 php.ini Xdebug 设置:

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 变量:
export XDEBUG_CONFIG="idekey=PHPSTORM";
export PHP_IDE_CONFIG="serverName=docker";

进行 cli 连接时的 Xdebug 日志:
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/

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

关于php - 尽管禁用了 remote_autostart,Xdebug 仍为所有 cli 命令运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53206443/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com