![](/img/trans.png)
[英]Remote PHP Debugging from within WSL2 in Visual Studio Code
[英]Source files not found on Visual Studio Code PHP Debug (WSL server)
我在 Windows 10 上托管我網站的本地副本,而服務器在 WSL Linux bash 上運行。 我已經安裝了 Visual Studio Code 和 PHP 調試,配置了 Xdebug,並且調試是從 chrome 頁面成功觸發的。 但是,VS 代碼然后告訴我它“無法打開”我的 php 文件。 我在 json 配置文件中嘗試了各種路徑映射,但似乎沒有任何效果。
有人可以幫我嗎? 非常感謝!
我的設置 :
本地網站位置: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"
啟動.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:/",
}
}
]
}
我解決了這個在遠程打開工作區的錯誤:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.