Tar*_*ros 10 php xdebug phpstorm windows-subsystem-for-linux
我使用 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 之间建立链接?
小智 1
我使用 Windows 10 中的 WSL (Ubuntu 20.04 LTS) 作为 Web 服务器,使用 PHP 7.4 fpm 和 Apache 以及 Xdebug 版本 3.0.4
以下是在 PHPSTORM 中配置 Xdebugger 的步骤,它对我有用:
安装 Xdebug
在 cli 解释器中选择 wsl
要获取 client_host,请在 ubuntu 中运行 ifconfig 或在 bash 中运行ipconfig
打开下面的文件
sudo vi /etc/php/7.4/cli/conf.d/20-xdebug.ini
Run Code Online (Sandbox Code Playgroud)
在上面的文件中添加以下内容
zend_extension=xdebug.so
xdebug.mode=debug
xdebug.client_host=[ip4 address/Client_host]
xdebug.remote_connect_back=On
xdebug.client_port="9003"
xdebug.remote_handler=dbgp
xdebug.start_with_request=yes
xdebug.remote_log=/tmp/xdebug.log
Run Code Online (Sandbox Code Playgroud)
然后使用Xdebugger chrome扩展(xdebugger helper)
重新启动阿帕奇服务器。
在文件中添加断点并刷新页面