【发布时间】:2019-05-10 13:33:04
【问题描述】:
我在 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:/",
}
}
]
}
【问题讨论】:
标签: php visual-studio-code xdebug windows-subsystem-for-linux