我使用 Windows 10 中的 WSL(Ubuntu 16.14)作为带有 PHP 7.1 fpm 和 Apache 的 Web 服务器。
我想将 PhpStorm 2018 中的 Xdebug 与 WSL 一起使用,但效果不佳。
Xdebug 安装在我的 Ubuntu 服务器上并且运行良好,我在phpinfo()输出中看到它。
这里是 Xdebug 的 php.ini 配置:
[Xdebug]
zend_extension="/usr/lib/php/20170718/xdebug.so"
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
xdebug.remote_connect_back=On
xdebug.remote_host=127.0.0.1
xdebug.remote_port = 9001
xdebug.idekey = PHPSTORM
Run Code Online (Sandbox Code Playgroud)
我在 php Storm 中也将端口配置为 9001。
问题更多是在 PhpStorm 和 WSL 之间的连接上。我用远程方式试试。在Run > Edit config弹出窗口中,我使用 PHP 网页,当我使用验证工具时,除远程主机外一切正常。我将它设置为 127.0.0.1,这就是重点。
当我听调试工具时,它说:端口 9001 繁忙
如何在 localhost 和 localhost 之间建立链接?