我在Windows 10上托管我的网站的本地副本,而服务器在WSL Linux bash上运行 . 我已经安装了Visual Studio Code和PHP调试,配置了Xdebug,并且从chrome页面成功触发了调试 . 但是,VS代码然后告诉我它“无法打开”我的php文件 . 我在json配置文件中尝试了各种pathMappings,但似乎没有任何工作 .
有人可以帮助我吗?非常感谢提前!
我的设置 :
本地网站位置:D:/ local_websites /来自linux服务器的对应路径:/ mnt / d / local_websites /
xdebug.ini:
zend_extension=xdebug.so
xdebug.show_error_trace = 1
xdebug.remote_enable = 1
xdebug.remote_connect_back = 0
xdebug.remote_autostart = 1
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.remote_host=127.0.0.1
xdebug.remote_log="/var/log/xdebug/xdebug.log"
launch.json:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9000
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"port": 9000,
"pathMappings": {
"/mnt/d/": "d:/",
}
}
]
}