WSL2+PhpStorm+xdebug环境下端口连接不通

问题描述:

 在WSL环境下搭建nginx+php-fpm环境,安装xdebug扩展后,按照常规的xdebug配置方法进行配置无法进入debug,查看xdebug日志,显示如下错误

[246] Log opened at 2020-08-05 11:09:01
[246] I: Connecting to configured address/port: 127.0.0.1:9009.
[246] W: Creating socket for '127.0.0.1:9009', poll success, but error: Operation now in progress (29).
[246] E: Could not connect to client. :-(
[246] Log closed at 2020-08-05 11:09:01

  尝试在WSL上用telnet去连接127.0.0.1:9009,同样返回无法连接

Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused

  此时,需要将127.0.0.1改为window下WSL的IP地址,即下图所示地址

原文地址:https://www.cnblogs.com/dreamydeng/p/13442263.html