0

我正在使用本课程在 Docker 上设置 Xdebug - https://github.com/markshust/docker-magento

该站点已启动并运行良好,但 Xdebug 将无法正常工作。在 Chrome 浏览器上,我有这个设置- 在此处输入图像描述

它在此处启用- 在此处输入图像描述

这是我在 PHPStorm 上的设置: 在此处输入图像描述

这是运行/调试配置的样子 - 在此处输入图像描述

这是我所有的php信息- 在此处输入图像描述

这是为了表明我没有忘记断点- 在此处输入图像描述

我错过了什么?

编辑:Xdebug 配置 在此处输入图像描述

在此处输入图像描述

编辑:以文本形式 - xdebug

Version => 3.1.2
Support Xdebug on Patreon, GitHub, or as a business: 
https://xdebug.org/support

         Enabled Features (through 'xdebug.mode' setting)             
Feature => Enabled/Disabled
Development Helpers => ✘ disabled
Coverage => ✘ disabled
GC Stats => ✘ disabled
Profiler => ✘ disabled
Step Debugger => ✘ disabled
Tracing => ✘ disabled

                        Optional Features                            
Compressed File Support => yes (gzip)
Clock Source => clock_gettime

Directive => Local Value => Master Value
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 => host.docker.internal => 
host.docker.internal
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 => PHPSTORM => PHPSTORM
xdebug.log => no value => no value
xdebug.log_level => 7 => 7
xdebug.max_nesting_level => 256 => 256
xdebug.max_stack_frames => -1 => -1
xdebug.mode => no value => no value
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 => default => default
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 => 1 => 1
xdebug.var_display_max_children => 128 => 128
xdebug.var_display_max_data => 512 => 512
xdebug.var_display_max_depth => 3 => 3

当我尝试验证时的样子—— 在此处输入图像描述

4

2 回答 2

1

虽然我不能确切地说出问题所在,但我建议进行以下更改:

  • 确保运行菜单有这个菜单项:停止侦听 PHP 调试连接
  • 删除Filter debug connection by IDE key配置。如果您有多个需要访问不同环境的网站,IDE 密钥会有些用处,但我猜这对您来说不是问题。
  • 启用Break at first line in PHP scripts.

此处的故障排除部分可能还有一些其他想法。

于 2021-12-08T15:19:31.913 回答
1

由于您使用的是 Linux/Ubuntu,因此host.docker.internal主机条目可能未在您的本地计算机上设置,这意味着 Xdebug 将无法将 Docker 视为要连接的服务器。

这应该可以通过在本地机器的/etc/hosts文件中添加一个包含 Docker 网络 IP 值的条目来解决。

您可以通过运行以下命令检索 Docker 网络 IP:

docker network inspect bridge --format='{{(index .IPAM.Config 0).Gateway}}'

然后,假设值为172.17.0.1,您可以/etc/hosts像这样添加条目:

172.17.0.1 host.docker.internal

host.docker.internal会将主机名绑定到您的 Docker 守护程序,因此现在 Xdebug 将能够连接到它。

于 2021-12-08T22:31:26.207 回答