Php 远程去窃听赢得';t使用Docker在断点处停止,VScode

Php 远程去窃听赢得';t使用Docker在断点处停止,VScode,php,docker,debugging,visual-studio-code,xdebug,Php,Docker,Debugging,Visual Studio Code,Xdebug,远程调试不会在断点处停止 远程调试如何在断点处停止 使用 Visual Studio代码(带有php调试扩展) xdebug(版本2.6.0) Docker(版本18.09.0-ce-beta1) docker compose(版本1.22.0) xdebug配置 我可以通过phpinfo中的Xdebug v2.6.0和Xdebug config查看, 因此xdebug配置设置正确 这是xdebug配置 $ php -i | grep xdebug

远程调试不会在断点处停止

远程调试如何在断点处停止

使用
  • Visual Studio代码(带有php调试扩展)
  • xdebug(版本2.6.0)
  • Docker(版本18.09.0-ce-beta1)
  • docker compose(版本1.22.0)
xdebug配置 我可以通过phpinfo中的Xdebug v2.6.0和Xdebug config查看
,
因此xdebug配置设置正确

这是xdebug配置

$ 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 => vscode => vscode
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 => Off => Off
xdebug.remote_cookie_expire_time => 3600 => 3600
xdebug.remote_enable => On => On
xdebug.remote_handler => dbgp => dbgp
xdebug.remote_host => host.docker.internal => host.docker.internal
xdebug.remote_log => no value => no value
xdebug.remote_mode => req => req
xdebug.remote_port => 90055555 => 90055555
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
VSCode配置 笔记
  • xdebug也不会停在
    xdebug_break();
    这是否意味着xdebug和docker主机未连接

  • 将xdebug_远程_主机从host.docker.internal更改为
    127.18.0.4
    也会失败


我试图回答你的问题,但Yvette Colomb删除了我的答案,因为这与我对几乎相同的问题给出的答案相同。因此,为了实际帮助您,而不是像她所要求的那样将您的问题作为一个副本来结束,这里有一个指向先前答案的链接:-特别尝试将
xdebug.remote\u connect\u back=1
添加到您的
php.ini
。谢谢!我试过了,但没有改变。还有其他想法吗?嗯,通常是这样。也许您可以看到我们的PHP容器是如何配置的,因为它们都与XDEBUG和VSCode一起工作:我为phalcon使用官方docker容器。。我不想换容器…好的!我试试看!
{
    "version": "0.2.0",
    "configurations": [

        {
            "name": "stackOverflow",
            "type": "php",
            "request": "launch",
            "port": 9005,
            "pathMappings": {
                "/app": "/home/user/test"
              }
        },
        {
            "name": "Launch currently open script",
            "type": "php",
            "request": "launch",
            "program": "${file}",
            "cwd": "${fileDirname}",
            "port": 9000
        }
    ]
}