0

I have WSL running PHP 7.4 on Ubuntu 18.04 and using PhpStorm 2020 on a new Windows 10 build. I cannot seem to get Xdebug to stop at breakpoints or even log errors.

From phpinfo()

Version 3.0.1
Support Xdebug on Patreon, GitHub, or as a business
Feature Enabled/Disabled    Docs
Development Aids    ✔ enabled   
Coverage    ✘ disabled  
GC Stats    ✘ disabled  
Profiler    ✘ disabled  
Step Debugger   ✘ disabled  
Tracing ✘ disabled  
Directive   Local Value Master Value
xdebug.auto_trace   This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.auto_trace" This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.auto_trace"
xdebug.cli_color    0   0
xdebug.client_discovery_header  no value    no value
xdebug.client_host  localhost   localhost
xdebug.client_port  9003    9003
xdebug.cloud_id no value    no value
xdebug.collect_assignments  Off Off
xdebug.collect_includes This setting has been removed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#removed-"xdebug.collect_includes"   This setting has been removed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#removed-"xdebug.collect_includes"
xdebug.collect_params   This setting has been removed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#removed-"xdebug.collect_params" This setting has been removed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#removed-"xdebug.collect_params"
xdebug.collect_return   Off Off
xdebug.collect_vars This setting has been removed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#removed-"xdebug.collect_vars"   This setting has been removed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#removed-"xdebug.collect_vars"
xdebug.connect_timeout_ms   200 200
xdebug.coverage_enable  This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.coverage_enable"    This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.coverage_enable"
xdebug.default_enable   This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.default_enable" This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.default_enable"
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  This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.gc_stats_enable"    This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.gc_stats_enable"
xdebug.gc_stats_output_dir  This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.gc_stats_output_dir"    This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.gc_stats_output_dir"
xdebug.gc_stats_output_name gcstats.%p  gcstats.%p
xdebug.halt_level   0   0
xdebug.idekey   no value    no value
xdebug.log  /var/log/xdebug.log /var/log/xdebug.log
xdebug.log_level    7   7
xdebug.max_nesting_level    256 256
xdebug.max_stack_frames -1  -1
xdebug.mode develop develop
xdebug.output_dir   /tmp    /tmp
xdebug.overload_var_dump    This setting has been removed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#removed-"xdebug.overload_var_dump"  This setting has been removed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#removed-"xdebug.overload_var_dump"
xdebug.profiler_append  Off Off
xdebug.profiler_enable  This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.profiler_enable"    This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.profiler_enable"
xdebug.profiler_enable_trigger  This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.profiler_enable_trigger"    This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.profiler_enable_trigger"
xdebug.profiler_enable_trigger_value    This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.profiler_enable_trigger_value"  This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.profiler_enable_trigger_value"
xdebug.profiler_output_dir  This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.profiler_output_dir"    This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.profiler_output_dir"
xdebug.profiler_output_name cachegrind.out.%p   cachegrind.out.%p
xdebug.remote_autostart This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.remote_autostart"   This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.remote_autostart"
xdebug.remote_connect_back  This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.remote_connect_back"    This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.remote_connect_back"
xdebug.remote_enable    1   1
xdebug.remote_host  This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.remote_host"    This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.remote_host"
xdebug.remote_log   This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.remote_log" This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.remote_log"
xdebug.remote_log_level This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.remote_log_level"   This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.remote_log_level"
xdebug.remote_mode  This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.remote_mode"    This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.remote_mode"
xdebug.remote_port  24680   24680
xdebug.remote_timeout   This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.remote_timeout" This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.remote_timeout"
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   This setting has been removed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#removed-"xdebug.show_mem_delta" This setting has been removed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#removed-"xdebug.show_mem_delta"
xdebug.start_upon_error default default
xdebug.start_with_request   default default
xdebug.trace_enable_trigger This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.trace_enable_trigger"   This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.trace_enable_trigger"
xdebug.trace_enable_trigger_value   This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.trace_enable_trigger_value" This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.trace_enable_trigger_value"
xdebug.trace_format 0   0
xdebug.trace_options    0   0
xdebug.trace_output_dir This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.trace_output_dir"   This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-"xdebug.trace_output_dir"
xdebug.trace_output_name    trace.%c    trace.%c
xdebug.trigger_value    no value    no value
xdebug.var_display_max_children 128 128
xdebug.var_display_max_data 512 512
xdebug.var_display_max_depth    3   3

And from /etc/php/$phpNo/fpm/php.ini

[xdebug]
zend_extension = /usr/lib/php/20190902/xdebug.so
xdebug.remote_enable = 1 
xdebug.remote_port = 24680   
xdebug.log=/var/log/xdebug.loga

With PhpStorm as 'zero' configuration

enter image description here

And server setting

enter image description here

This is a configuration setup I have used on WSL 1. All research into this points to reverting to WSL 1 which I consider a MASSIVE backwards step, indeed looking into actually reverting highlights extensive problems in itself, some showing the need to reinstall windows itself.

Help on this would be much appreciated as no actual fix seems available on what should be a very common usage of WSL2. Anyone got this working ?

LazyOne
  • 158,824
  • 45
  • 388
  • 391
Datadimension
  • 872
  • 1
  • 12
  • 31
  • 1
    **RE: Xdebug.** Did you actually checked what Xdebug section of `phpinfo()` output says? *"This setting has been changed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide..."*. In short: you are using Xdebug **v3** but keep using Xdebug **v2** config params. Most of them (almost all from important ones) do NOTHING in v3. Please go through the Upgrade Guide and alter your config params as needed: https://xdebug.org/docs/upgrade_guide – LazyOne Dec 28 '20 at 16:02
  • 1
    `xdebug.remote_enable = 1`, `xdebug.remote_port = 24680` -- these are v2 configs. Somehow you already have one v3 param already: `xdebug.log=/var/log/xdebug.log`. It's a common issue now (and will be for a while) to spot this v2 vs v3 moment .. so there are quite a few questions around. For example (answered by me): https://stackoverflow.com/a/65455794/783119, https://stackoverflow.com/a/65350070/783119, https://stackoverflow.com/a/65141934/783119 – LazyOne Dec 28 '20 at 16:06
  • Just in case: these comments are about Xdebug config and nothing about WSL2 (which might be yet another issue -- not really using it so cannot advise on that (the difference with WSL1)) – LazyOne Dec 28 '20 at 16:07
  • LazyOne seems to nearly have the solution on https://stackoverflow.com/questions/65137732/xdebug-v3-doesnt-stop-breakpoints-in-vscode/65141934#65141934 however is there a way to avoid manually entering the server address every WSL session eg I have to put xdebug.client_host = 172.31.96.1 to get it to connect to the IDE – Datadimension Dec 29 '20 at 17:22
  • Yeah .. WSL2 makes new IP address every time (when you restart PC or maybe on log on). 1) Try `xdebug.discover_client_host = true` first and see if it works. If not 2) just google "Xdebug WSL2" and go through the links, for example: https://medium.com/@tomasbruckner/intellij-xdebug-with-wsl-2-docker-4224b6efb0bb, https://gcompagnon.github.io/wsl2/xdebug/vscode/php-fpm/2019/09/17/WSL2_php_VSCode_Xdebug.html, https://stackoverflow.com/questions/63417516/unable-to-get-phpstorm-to-connect-to-xdebug-running-in-wsl-2, https://www.silverf0x00.com/setting-up-xdebug-for-phpstorm-on-windows-wsl2/ – LazyOne Dec 29 '20 at 17:39

0 Answers0