title: Cannot connect to Xdebug from PhpStorm after updating to WSL2
body: <p>Environment</p>
  <ul>
  <li>OS: Windows 10 Pro 1909</li>
  <li>WSL: Ubuntu (18.04. 5)</li>
  <li>PHP: 7.3</li>
  <li>PhpStorm: 2020.2</li>
  </ul>
  <p>I heard that WSL2 can work with 1909, so I upgraded my Ubuntu from WSL1 to 2.
  When I tried to debug with PhpStorm after setting it up, &quot;Connection was not established.&quot; was displayed.</p>
  <p>And then I looked at the log,</p>
  <pre><code>[2640] Log opened at 2020 xx-xx: xx: xx
  [2640] I: Connecting to configured address/port: localhost: 9001.
  [2640] W: Creating socket for 'localhost: 9001', poll success, but error: Operation now in progress (29).
  [2640] E: Could not connect to client.: - (
  [2640] Log closed at 2020 xx-xx: xx: xx
  </code></pre>
  <p>was displayed.</p>
  <p>I tried changing various Xdebug settings, but I couldn't connect to any of them.</p>
  <p>Since WSL2, the IP address has been different, but I heard that it is now possible to use localhost, so I changed it to localhost, but it still didn't work.</p>
  <p>Is it impossible to use WSL2 at present? Or is there any way?
  Thank you in advance.</p>
  <p>/etc/php/7.3/cli/php.ini:</p>
  <pre><code>[xdebug]
  ;extension_dir = &quot;/usr/lib/php/20190902&quot;                                           
  ;zend_extension = &quot;/usr/lib/php/20190902/xdebug.so&quot;
  xdebug.remote_enable=1
  xdebug.remote_autostart=1
  xdebug.profiler_enable=1
  xdebug.profiler_output_dir=&quot;/tmp&quot;
  xdebug.remote_enable=1
  xdebug.remote_host=&quot;localhost&quot;
  xdebug.remote_port=9001
  xdebug.remote_log=/var/log/xdebug.log
  xdebug.idekey = &quot;PHPSTORM&quot;
  </code></pre>
  <p>/etc/php/7.3/cgi/conf.d/20-xdebug</p>
  <pre><code>zend_extension=xdebug.so
   
  xdebug.remote_enable = 1
  xdebug.remote_autostart = 1
  xdebug.remote_port = 9001
  xdebug.remote_host = &quot;localhost&quot;
  xdebug.remote_log=/var/log/xdebug.log
  xdebug.profiler_enable = 1
  xdebug.profiler_output_dir = &quot;/tmp&quot;
  xdebug.max_nesting_level = 1000
  xdebug.idekey = &quot;PHPSTORM&quot;
  </code></pre>
  <p>phpinfo:</p>
  <pre><code>php -info | grep -i xdebug                    
  /etc/php/7.3/cli/conf.d/20-xdebug.ini,
      with Xdebug v2.9.6, Copyright (c) 2002-2020, by Derick Rethans
  xdebug
  xdebug support =&gt; enabled
  Support Xdebug on Patreon, GitHub, or as a business: https://xdebug.org/support
  xdebug.auto_trace =&gt; Off =&gt; Off
  xdebug.cli_color =&gt; 0 =&gt; 0
  xdebug.collect_assignments =&gt; Off =&gt; Off
  xdebug.collect_includes =&gt; On =&gt; On
  xdebug.collect_params =&gt; 0 =&gt; 0
  xdebug.collect_return =&gt; Off =&gt; Off
  xdebug.collect_vars =&gt; Off =&gt; Off
  xdebug.coverage_enable =&gt; On =&gt; On
  xdebug.default_enable =&gt; On =&gt; On
  xdebug.dump.COOKIE =&gt; no value =&gt; no value
  xdebug.dump.ENV =&gt; no value =&gt; no value
  xdebug.dump.FILES =&gt; no value =&gt; no value
  xdebug.dump.GET =&gt; no value =&gt; no value
  xdebug.dump.POST =&gt; no value =&gt; no value
  xdebug.dump.REQUEST =&gt; no value =&gt; no value
  xdebug.dump.SERVER =&gt; no value =&gt; no value
  xdebug.dump.SESSION =&gt; no value =&gt; no value
  xdebug.dump_globals =&gt; On =&gt; On
  xdebug.dump_once =&gt; On =&gt; On
  xdebug.dump_undefined =&gt; Off =&gt; Off
  xdebug.file_link_format =&gt; no value =&gt; no value
  xdebug.filename_format =&gt; no value =&gt; no value
  xdebug.force_display_errors =&gt; Off =&gt; Off
  xdebug.force_error_reporting =&gt; 0 =&gt; 0
  xdebug.gc_stats_enable =&gt; Off =&gt; Off
  xdebug.gc_stats_output_dir =&gt; /tmp =&gt; /tmp
  xdebug.gc_stats_output_name =&gt; gcstats.%p =&gt; gcstats.%p
  xdebug.halt_level =&gt; 0 =&gt; 0
  xdebug.idekey =&gt; PHPSTORM =&gt; PHPSTORM
  xdebug.max_nesting_level =&gt; 1000 =&gt; 1000
  xdebug.max_stack_frames =&gt; -1 =&gt; -1
  xdebug.overload_var_dump =&gt; 2 =&gt; 2
  xdebug.profiler_append =&gt; Off =&gt; Off
  xdebug.profiler_enable =&gt; On =&gt; On
  xdebug.profiler_enable_trigger =&gt; Off =&gt; Off
  xdebug.profiler_enable_trigger_value =&gt; no value =&gt; no value
  xdebug.profiler_output_dir =&gt; /tmp =&gt; /tmp
  xdebug.profiler_output_name =&gt; cachegrind.out.%p =&gt; cachegrind.out.%p
  xdebug.remote_addr_header =&gt; no value =&gt; no value
  xdebug.remote_autostart =&gt; On =&gt; On
  xdebug.remote_connect_back =&gt; Off =&gt; Off
  xdebug.remote_cookie_expire_time =&gt; 3600 =&gt; 3600
  xdebug.remote_enable =&gt; On =&gt; On
  xdebug.remote_host =&gt; localhost =&gt; localhost
  xdebug.remote_log =&gt; /var/log/xdebug.log =&gt; /var/log/xdebug.log
  xdebug.remote_log_level =&gt; 7 =&gt; 7
  xdebug.remote_mode =&gt; req =&gt; req
  xdebug.remote_port =&gt; 9001 =&gt; 9001
  xdebug.remote_timeout =&gt; 200 =&gt; 200
  xdebug.scream =&gt; Off =&gt; Off
  xdebug.show_error_trace =&gt; Off =&gt; Off
  xdebug.show_exception_trace =&gt; Off =&gt; Off
  xdebug.show_local_vars =&gt; Off =&gt; Off
  xdebug.show_mem_delta =&gt; Off =&gt; Off
  xdebug.trace_enable_trigger =&gt; Off =&gt; Off
  xdebug.trace_enable_trigger_value =&gt; no value =&gt; no value
  xdebug.trace_format =&gt; 0 =&gt; 0
  xdebug.trace_options =&gt; 0 =&gt; 0
  xdebug.trace_output_dir =&gt; /tmp =&gt; /tmp
  xdebug.trace_output_name =&gt; trace.%c =&gt; trace.%c
  xdebug.var_display_max_children =&gt; 128 =&gt; 128
  xdebug.var_display_max_data =&gt; 512 =&gt; 512
  xdebug.var_display_max_depth =&gt; 3 =&gt; 3
  </code></pre>
  <p>Interpreters:
  <a href="https://i.stack.imgur.com/FsJ13.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FsJ13.png" alt="enter image description here" /></a></p>
  <p>Debug:
  <a href="https://i.stack.imgur.com/mLXPc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mLXPc.png" alt="enter image description here" /></a></p>