首页 > 解决方案 > 使用 WSL2 时 VSCode Php 调试器无法正常工作

问题描述

我已经在 Windows 10 上安装了 WSL2,设置了 LAMP 并安装了 php-xdebug。

/etc/php/8.0/mods-available/xdebug.ini我添加了这个:

zend_extension=xdebug.so
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
xdebug.show_error_trace = 1
xdebug.remote_port=9000

之后我运行sudo service apache2 restart命令。

然后在 VSCode 中添加断点,在 Chrome 上访问本地开发站点,它不起作用。它不会在断点处停止。

我以前在 WSL 上做这个已经 2 年多了,但现在我不知道为什么它不再起作用了......

有人有想法吗?

标签: phpvisual-studio-codexdebugwsl-2php-8

解决方案


推荐阅读