Xdebug 始终监听新请求并阻止网页加载以防我不监听
Xdebug always listening for new requests and prevents webpages from loading in case I don't listen
我在我的新工作场所有一个奇怪的设置,它是这样工作的:如果我有 PhpStorm 运行 并打开“开始侦听 PHP 调试连接”,那么我的本地 PHP 应用程序工作正常。一旦我完全关闭 PhpStorm(并因此停止监听 PHP 调试连接),我的网页就不会加载(nginx 在一分钟后超时)。
这是我的 xdebug.ini 配置:
xdebug.mode=debug
xdebug.start_with_request=no
xdebug.discover_client_host=no
xdebug.client_host=127.0.0.1
xdebug.log_level=0
;xdebug.log=/var/log/xdebug.log
这是 php -i | grep -i xdebug
的输出:
/etc/php/7.4/cli/conf.d/20-xdebug.ini,
with Xdebug v3.1.1, Copyright (c) 2002-2021, by Derick Rethans
xdebug
Support Xdebug on Patreon, GitHub, or as a business: https://xdebug.org/support
Enabled Features (through 'xdebug.mode' setting)
xdebug.auto_trace => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
xdebug.cli_color => 0 => 0
xdebug.client_discovery_header => no value => no value
xdebug.client_host => 127.0.0.1 => 127.0.0.1
xdebug.client_port => 9003 => 9003
xdebug.cloud_id => no value => no value
xdebug.collect_assignments => Off => Off
xdebug.collect_includes => (setting removed in Xdebug 3) => (setting removed in Xdebug 3)
xdebug.collect_params => (setting removed in Xdebug 3) => (setting removed in Xdebug 3)
xdebug.collect_return => Off => Off
xdebug.collect_vars => (setting removed in Xdebug 3) => (setting removed in Xdebug 3)
xdebug.connect_timeout_ms => 200 => 200
xdebug.coverage_enable => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
xdebug.default_enable => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
xdebug.discover_client_host => Off => Off
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.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 => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
xdebug.gc_stats_output_dir => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
xdebug.gc_stats_output_name => gcstats.%p => gcstats.%p
xdebug.halt_level => 0 => 0
xdebug.idekey => no value => no value
xdebug.log => no value => no value
xdebug.log_level => 0 => 0
xdebug.max_nesting_level => 256 => 256
xdebug.max_stack_frames => -1 => -1
xdebug.mode => debug => debug
xdebug.output_dir => /tmp => /tmp
xdebug.overload_var_dump => (setting removed in Xdebug 3) => (setting removed in Xdebug 3)
xdebug.profiler_append => Off => Off
xdebug.profiler_enable => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
xdebug.profiler_enable_trigger => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
xdebug.profiler_enable_trigger_value => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
xdebug.profiler_output_dir => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
xdebug.profiler_output_name => cachegrind.out.%p => cachegrind.out.%p
xdebug.remote_autostart => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
xdebug.remote_connect_back => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
xdebug.remote_enable => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
xdebug.remote_host => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
xdebug.remote_log => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
xdebug.remote_log_level => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
xdebug.remote_mode => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
xdebug.remote_port => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
xdebug.remote_timeout => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
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 => (setting removed in Xdebug 3) => (setting removed in Xdebug 3)
xdebug.start_upon_error => default => default
xdebug.start_with_request => no => no
xdebug.trace_enable_trigger => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
xdebug.trace_enable_trigger_value => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
xdebug.trace_format => 0 => 0
xdebug.trace_options => 0 => 0
xdebug.trace_output_dir => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
xdebug.trace_output_name => trace.%c => trace.%c
xdebug.trigger_value => no value => no value
xdebug.use_compression => 0 => 0
xdebug.var_display_max_children => 128 => 128
xdebug.var_display_max_data => 512 => 512
xdebug.var_display_max_depth => 3 => 3
有趣的是,我什至尝试完全卸载 Xdebug,但我仍然遇到同样的问题(不过我不确定我是否正确地卸载了)。
有什么方法可以阻止 Xdebug 建立连接吗? (并在我真正需要调试时启用它)
我在 Windows (Ubuntu 20.04) 的 WSL 下使用 PHP 7.4.25、Xdebug v3.1.1 和 运行 它。我也是 运行 nginx v1.21.4 背后的一切。
更新 1:
正如@LazyOne 所问,这是我的 xdebug_info() 输出:
screenshot of xdebug_info output
second part of xdebug_info
更新 2
这里是 /etc/php/7.4/fpm/conf.d/xdebug.ini 的输出:
[xdebug]
xdebug.mode=debug
xdebug.start_with_request=no
xdebug.discover_client_host=no
xdebug.client_host=127.0.0.1
xdebug.log_level=0
xdebug.connect_timeout_ms=0
;xdebug.log=/var/log/xdebug.log
#zend_extension=xdebug.so
#xdebug.mode=debug
#xdebug.start_with_request=yes
#xdebug.start_upon_error=yes
#xdebug.discover_client_host=yes
#xdebug.client_host=10.0.10.1
#xdebug.client_port=9000
#xdebug.log_level=0
#xdebug.log=/var/log/xdebug.log
#xdebug.profiler_enable=1
#xdebug.remote_enable=1
#xdebug.remote_handler=dbgp
#xdebug.remote_mode=req
#xdebug.remote_autostart=1
#xdebug.remote_connect_back=1
#xdebug.idekey=PHPSTORM
#xdebug.show_exception_trace
这也是我的/etc/php/7.4/fpm/conf.d/20-xdebug.ini
[xdebug]
zend_extension=xdebug.so
xdebug.mode=debug
xdebug.start_with_request=no
xdebug.discover_client_host=no
xdebug.client_host=127.0.0.1
xdebug.log_level=10
xdebug.remote_autostart = 0
xdebug.log=/tmp/xdebug/xdebug.log
xdebug.connect_timeout_ms=0
这是grep -Ri xdebug /etc/php/7.4/fpm/conf.d/
的输出:
root@DESKTOP-UB3H2M6:/var/www# grep -Ri xdebug /etc/php/7.4/fpm/conf.d/
/etc/php/7.4/fpm/conf.d/20-xdebug.ini:[xdebug]
/etc/php/7.4/fpm/conf.d/20-xdebug.ini:zend_extension=xdebug.so
/etc/php/7.4/fpm/conf.d/20-xdebug.ini:xdebug.mode=debug
/etc/php/7.4/fpm/conf.d/20-xdebug.ini:xdebug.start_with_request=no
/etc/php/7.4/fpm/conf.d/20-xdebug.ini:xdebug.discover_client_host=no
/etc/php/7.4/fpm/conf.d/20-xdebug.ini:xdebug.client_host=127.0.0.1
/etc/php/7.4/fpm/conf.d/20-xdebug.ini:xdebug.log_level=10
/etc/php/7.4/fpm/conf.d/20-xdebug.ini:xdebug.remote_autostart = 0
/etc/php/7.4/fpm/conf.d/20-xdebug.ini:xdebug.log=/tmp/xdebug/xdebug.log
/etc/php/7.4/fpm/conf.d/20-xdebug.ini:xdebug.connect_timeout_ms=0
/etc/php/7.4/fpm/conf.d/xdebug.ini:[xdebug]
/etc/php/7.4/fpm/conf.d/xdebug.ini:xdebug.mode=debug
/etc/php/7.4/fpm/conf.d/xdebug.ini:xdebug.start_with_request=no
/etc/php/7.4/fpm/conf.d/xdebug.ini:xdebug.discover_client_host=no
/etc/php/7.4/fpm/conf.d/xdebug.ini:xdebug.client_host=127.0.0.1
/etc/php/7.4/fpm/conf.d/xdebug.ini:xdebug.log_level=0
/etc/php/7.4/fpm/conf.d/xdebug.ini:xdebug.connect_timeout_ms=0
/etc/php/7.4/fpm/conf.d/xdebug.ini:;xdebug.log=/var/log/xdebug.log
/etc/php/7.4/fpm/conf.d/xdebug.ini:#zend_extension=xdebug.so
/etc/php/7.4/fpm/conf.d/xdebug.ini:#xdebug.mode=debug
/etc/php/7.4/fpm/conf.d/xdebug.ini:#xdebug.start_with_request=yes
/etc/php/7.4/fpm/conf.d/xdebug.ini:#xdebug.start_upon_error=yes
/etc/php/7.4/fpm/conf.d/xdebug.ini:#xdebug.discover_client_host=yes
/etc/php/7.4/fpm/conf.d/xdebug.ini:#xdebug.client_host=10.0.10.1
/etc/php/7.4/fpm/conf.d/xdebug.ini:#xdebug.client_port=9000
/etc/php/7.4/fpm/conf.d/xdebug.ini:#xdebug.log_level=0
/etc/php/7.4/fpm/conf.d/xdebug.ini:#xdebug.log=/var/log/xdebug.log
/etc/php/7.4/fpm/conf.d/xdebug.ini:#xdebug.profiler_enable=1
/etc/php/7.4/fpm/conf.d/xdebug.ini:#xdebug.remote_enable=1
/etc/php/7.4/fpm/conf.d/xdebug.ini:#xdebug.remote_handler=dbgp
/etc/php/7.4/fpm/conf.d/xdebug.ini:#xdebug.remote_mode=req
/etc/php/7.4/fpm/conf.d/xdebug.ini:#xdebug.remote_autostart=1
/etc/php/7.4/fpm/conf.d/xdebug.ini:#xdebug.remote_connect_back=1
/etc/php/7.4/fpm/conf.d/xdebug.ini:#xdebug.idekey=PHPSTORM
/etc/php/7.4/fpm/conf.d/xdebug.ini:#xdebug.show_exception_trace
Is there anyway that I prevent xdebug to listening?
不,因为监听的不是 Xdebug。 Xdebug 与 PhpStorm 建立连接,PhpStorm 可以侦听传入的调试连接。
可能由于某种原因,Xdebug 仍然尝试连接到 IDE,即使它没有在监听。连接时 Xdebug 端通常有 200 毫秒的超时,但我看到一些网络设置阻碍了这一点。
为了找出什么,如果 Xdebug 仍在做某事,请创建一个日志文件,方法是更改 xdebug.ini
以包含以下内容,然后重新启动 Apache:
xdebug.log_level=10
xdebug.log=/var/log/xdebug.log
日志文件会非常详细地显示 Xdebug 是否仍在尝试连接(因为您将 xdebug.log_level
设置为 10)。
首先我在 xdebug 向导的帮助下安装了 xdebug,然后我这样配置文件:
在我的例子中是:/etc/php/7.4/cli/conf.d/20-xdebug.ini
zend_extension=xdebug.so
xdebug.mode=debug
xdebug.client_host="your local ip address of the machine" for me was 192.168.68.102
xdebug.remote_connect_back=On
xdebug.client_port="9003"
xdebug.remote_handler=dbgp
xdebug.start_with_request=yes
xdebug.remote_log=/tmp/xdebug.log
然后在 phpstorm 中我配置了 PHP-> 服务器的映射:例如“src”->“/var/www/src”,你必须对所有你想调试的文件夹进行配置.
最后我像这样配置了 Cli 解释器:
The bin of the php and the remote host
我在我的新工作场所有一个奇怪的设置,它是这样工作的:如果我有 PhpStorm 运行 并打开“开始侦听 PHP 调试连接”,那么我的本地 PHP 应用程序工作正常。一旦我完全关闭 PhpStorm(并因此停止监听 PHP 调试连接),我的网页就不会加载(nginx 在一分钟后超时)。
这是我的 xdebug.ini 配置:
xdebug.mode=debug
xdebug.start_with_request=no
xdebug.discover_client_host=no
xdebug.client_host=127.0.0.1
xdebug.log_level=0
;xdebug.log=/var/log/xdebug.log
这是 php -i | grep -i xdebug
的输出:
/etc/php/7.4/cli/conf.d/20-xdebug.ini,
with Xdebug v3.1.1, Copyright (c) 2002-2021, by Derick Rethans
xdebug
Support Xdebug on Patreon, GitHub, or as a business: https://xdebug.org/support
Enabled Features (through 'xdebug.mode' setting)
xdebug.auto_trace => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
xdebug.cli_color => 0 => 0
xdebug.client_discovery_header => no value => no value
xdebug.client_host => 127.0.0.1 => 127.0.0.1
xdebug.client_port => 9003 => 9003
xdebug.cloud_id => no value => no value
xdebug.collect_assignments => Off => Off
xdebug.collect_includes => (setting removed in Xdebug 3) => (setting removed in Xdebug 3)
xdebug.collect_params => (setting removed in Xdebug 3) => (setting removed in Xdebug 3)
xdebug.collect_return => Off => Off
xdebug.collect_vars => (setting removed in Xdebug 3) => (setting removed in Xdebug 3)
xdebug.connect_timeout_ms => 200 => 200
xdebug.coverage_enable => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
xdebug.default_enable => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
xdebug.discover_client_host => Off => Off
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.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 => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
xdebug.gc_stats_output_dir => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
xdebug.gc_stats_output_name => gcstats.%p => gcstats.%p
xdebug.halt_level => 0 => 0
xdebug.idekey => no value => no value
xdebug.log => no value => no value
xdebug.log_level => 0 => 0
xdebug.max_nesting_level => 256 => 256
xdebug.max_stack_frames => -1 => -1
xdebug.mode => debug => debug
xdebug.output_dir => /tmp => /tmp
xdebug.overload_var_dump => (setting removed in Xdebug 3) => (setting removed in Xdebug 3)
xdebug.profiler_append => Off => Off
xdebug.profiler_enable => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
xdebug.profiler_enable_trigger => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
xdebug.profiler_enable_trigger_value => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
xdebug.profiler_output_dir => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
xdebug.profiler_output_name => cachegrind.out.%p => cachegrind.out.%p
xdebug.remote_autostart => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
xdebug.remote_connect_back => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
xdebug.remote_enable => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
xdebug.remote_host => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
xdebug.remote_log => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
xdebug.remote_log_level => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
xdebug.remote_mode => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
xdebug.remote_port => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
xdebug.remote_timeout => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
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 => (setting removed in Xdebug 3) => (setting removed in Xdebug 3)
xdebug.start_upon_error => default => default
xdebug.start_with_request => no => no
xdebug.trace_enable_trigger => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
xdebug.trace_enable_trigger_value => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
xdebug.trace_format => 0 => 0
xdebug.trace_options => 0 => 0
xdebug.trace_output_dir => (setting renamed in Xdebug 3) => (setting renamed in Xdebug 3)
xdebug.trace_output_name => trace.%c => trace.%c
xdebug.trigger_value => no value => no value
xdebug.use_compression => 0 => 0
xdebug.var_display_max_children => 128 => 128
xdebug.var_display_max_data => 512 => 512
xdebug.var_display_max_depth => 3 => 3
有趣的是,我什至尝试完全卸载 Xdebug,但我仍然遇到同样的问题(不过我不确定我是否正确地卸载了)。
有什么方法可以阻止 Xdebug 建立连接吗? (并在我真正需要调试时启用它)
我在 Windows (Ubuntu 20.04) 的 WSL 下使用 PHP 7.4.25、Xdebug v3.1.1 和 运行 它。我也是 运行 nginx v1.21.4 背后的一切。
更新 1: 正如@LazyOne 所问,这是我的 xdebug_info() 输出:
screenshot of xdebug_info output
second part of xdebug_info
更新 2
这里是 /etc/php/7.4/fpm/conf.d/xdebug.ini 的输出:
[xdebug]
xdebug.mode=debug
xdebug.start_with_request=no
xdebug.discover_client_host=no
xdebug.client_host=127.0.0.1
xdebug.log_level=0
xdebug.connect_timeout_ms=0
;xdebug.log=/var/log/xdebug.log
#zend_extension=xdebug.so
#xdebug.mode=debug
#xdebug.start_with_request=yes
#xdebug.start_upon_error=yes
#xdebug.discover_client_host=yes
#xdebug.client_host=10.0.10.1
#xdebug.client_port=9000
#xdebug.log_level=0
#xdebug.log=/var/log/xdebug.log
#xdebug.profiler_enable=1
#xdebug.remote_enable=1
#xdebug.remote_handler=dbgp
#xdebug.remote_mode=req
#xdebug.remote_autostart=1
#xdebug.remote_connect_back=1
#xdebug.idekey=PHPSTORM
#xdebug.show_exception_trace
这也是我的/etc/php/7.4/fpm/conf.d/20-xdebug.ini
[xdebug]
zend_extension=xdebug.so
xdebug.mode=debug
xdebug.start_with_request=no
xdebug.discover_client_host=no
xdebug.client_host=127.0.0.1
xdebug.log_level=10
xdebug.remote_autostart = 0
xdebug.log=/tmp/xdebug/xdebug.log
xdebug.connect_timeout_ms=0
这是grep -Ri xdebug /etc/php/7.4/fpm/conf.d/
的输出:
root@DESKTOP-UB3H2M6:/var/www# grep -Ri xdebug /etc/php/7.4/fpm/conf.d/
/etc/php/7.4/fpm/conf.d/20-xdebug.ini:[xdebug]
/etc/php/7.4/fpm/conf.d/20-xdebug.ini:zend_extension=xdebug.so
/etc/php/7.4/fpm/conf.d/20-xdebug.ini:xdebug.mode=debug
/etc/php/7.4/fpm/conf.d/20-xdebug.ini:xdebug.start_with_request=no
/etc/php/7.4/fpm/conf.d/20-xdebug.ini:xdebug.discover_client_host=no
/etc/php/7.4/fpm/conf.d/20-xdebug.ini:xdebug.client_host=127.0.0.1
/etc/php/7.4/fpm/conf.d/20-xdebug.ini:xdebug.log_level=10
/etc/php/7.4/fpm/conf.d/20-xdebug.ini:xdebug.remote_autostart = 0
/etc/php/7.4/fpm/conf.d/20-xdebug.ini:xdebug.log=/tmp/xdebug/xdebug.log
/etc/php/7.4/fpm/conf.d/20-xdebug.ini:xdebug.connect_timeout_ms=0
/etc/php/7.4/fpm/conf.d/xdebug.ini:[xdebug]
/etc/php/7.4/fpm/conf.d/xdebug.ini:xdebug.mode=debug
/etc/php/7.4/fpm/conf.d/xdebug.ini:xdebug.start_with_request=no
/etc/php/7.4/fpm/conf.d/xdebug.ini:xdebug.discover_client_host=no
/etc/php/7.4/fpm/conf.d/xdebug.ini:xdebug.client_host=127.0.0.1
/etc/php/7.4/fpm/conf.d/xdebug.ini:xdebug.log_level=0
/etc/php/7.4/fpm/conf.d/xdebug.ini:xdebug.connect_timeout_ms=0
/etc/php/7.4/fpm/conf.d/xdebug.ini:;xdebug.log=/var/log/xdebug.log
/etc/php/7.4/fpm/conf.d/xdebug.ini:#zend_extension=xdebug.so
/etc/php/7.4/fpm/conf.d/xdebug.ini:#xdebug.mode=debug
/etc/php/7.4/fpm/conf.d/xdebug.ini:#xdebug.start_with_request=yes
/etc/php/7.4/fpm/conf.d/xdebug.ini:#xdebug.start_upon_error=yes
/etc/php/7.4/fpm/conf.d/xdebug.ini:#xdebug.discover_client_host=yes
/etc/php/7.4/fpm/conf.d/xdebug.ini:#xdebug.client_host=10.0.10.1
/etc/php/7.4/fpm/conf.d/xdebug.ini:#xdebug.client_port=9000
/etc/php/7.4/fpm/conf.d/xdebug.ini:#xdebug.log_level=0
/etc/php/7.4/fpm/conf.d/xdebug.ini:#xdebug.log=/var/log/xdebug.log
/etc/php/7.4/fpm/conf.d/xdebug.ini:#xdebug.profiler_enable=1
/etc/php/7.4/fpm/conf.d/xdebug.ini:#xdebug.remote_enable=1
/etc/php/7.4/fpm/conf.d/xdebug.ini:#xdebug.remote_handler=dbgp
/etc/php/7.4/fpm/conf.d/xdebug.ini:#xdebug.remote_mode=req
/etc/php/7.4/fpm/conf.d/xdebug.ini:#xdebug.remote_autostart=1
/etc/php/7.4/fpm/conf.d/xdebug.ini:#xdebug.remote_connect_back=1
/etc/php/7.4/fpm/conf.d/xdebug.ini:#xdebug.idekey=PHPSTORM
/etc/php/7.4/fpm/conf.d/xdebug.ini:#xdebug.show_exception_trace
Is there anyway that I prevent xdebug to listening?
不,因为监听的不是 Xdebug。 Xdebug 与 PhpStorm 建立连接,PhpStorm 可以侦听传入的调试连接。
可能由于某种原因,Xdebug 仍然尝试连接到 IDE,即使它没有在监听。连接时 Xdebug 端通常有 200 毫秒的超时,但我看到一些网络设置阻碍了这一点。
为了找出什么,如果 Xdebug 仍在做某事,请创建一个日志文件,方法是更改 xdebug.ini
以包含以下内容,然后重新启动 Apache:
xdebug.log_level=10
xdebug.log=/var/log/xdebug.log
日志文件会非常详细地显示 Xdebug 是否仍在尝试连接(因为您将 xdebug.log_level
设置为 10)。
首先我在 xdebug 向导的帮助下安装了 xdebug,然后我这样配置文件:
在我的例子中是:/etc/php/7.4/cli/conf.d/20-xdebug.ini
zend_extension=xdebug.so
xdebug.mode=debug
xdebug.client_host="your local ip address of the machine" for me was 192.168.68.102
xdebug.remote_connect_back=On
xdebug.client_port="9003"
xdebug.remote_handler=dbgp
xdebug.start_with_request=yes
xdebug.remote_log=/tmp/xdebug.log
然后在 phpstorm 中我配置了 PHP-> 服务器的映射:例如“src”->“/var/www/src”,你必须对所有你想调试的文件夹进行配置.
最后我像这样配置了 Cli 解释器: The bin of the php and the remote host