我在连接 Xdebug 时遇到问题:
Xdebug:[单步调试] 连接调试客户端超时,等待:200 毫秒。尝试过:host.docker.internal:9000(通过xdebug.client_host/xdebug.client_port)。
我正在从 WSL 运行 PhpStorm。另外我正在使用 Laradock,但我不知道如何配置它。
这是我在 laradock/workspace 中的 xdebug.ini:
xdebug.remote_host="host.docker.internal"
xdebug.remote_connect_back=0
xdebug.remote_port=9000
xdebug.idekey=PHPSTORM
xdebug.remote_autostart=0
xdebug.remote_enable=0
xdebug.cli_color=0
xdebug.profiler_enable=0
xdebug.profiler_output_dir="~/xdebug/phpstorm/tmp/profiling"
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.var_display_max_children=-1
xdebug.var_display_max_data=-1
xdebug.var_display_max_depth=-1
我不确定 xdebug.remote_host。
这是我在 PhpStorm 中的设置。有人可以帮我吗,我从周一开始就在尝试正确配置它。
我期待 Xdebug 能够正常工作。我尝试添加到
remote_host
我的 Windows IP、我的 WSL IP 和 host.docker.internal
。
Xdebug 无法连接到 PhpStorm,因为:
当您使用 Docker Desktop 时,
host.docker.internal
会将您发送到主机,即 Windows 计算机。您可以将
host.docker.internal
设置为 WSL 机器的 IP,而不是 xdebug.remote_host
。eth0
接口的 IP 是有效的;您可以通过在 WSL 终端中运行 ip a
来获取它。