Vscode php debug F5后沒有反應。
之前是可以用的,不知道什么原因,排查了一下發現之前的配置文件沒有了
檢查步驟:
1、先在vscode中安裝PHP Debug,在設置添加"php.validate.executablePath"項,選中對應版本的php.exe。
"php.validate.executablePath": "c:\\wamp\\bin\\php\\php7.2.14\\php.exe",
2、按F5調試,選擇PHP,就可以了,可能會配置失敗。
3、按 Ctrl+Shift+D 打開調試面板,點擊上面的小齒輪打開launch.json,如果出現"Listen for XDebug"和"Launch currently open script",就證明成功了,
可以調試了。
4、如果發現沒有,就需要手動添加了:
{
// 使用 IntelliSense 了解相關屬性。
// 懸停以查看現有屬性的描述。
// 欲了解更多信息,請訪問: 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
}
]
}
將配置文件添加后,又可以debug了好開心,又可以寫bug 了。
_______________________________________
2020.11.25 更新
在php.ini 配置文件中一定要加上這一行,否則vscode可能還是不起作用
xdebug.remote_autostart = 1
其他配置:
xdebug.remote_enable = 1
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
xdebug.remote_connect_back = 1
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 1
無效的情況下,務必檢查以上配置項是否都在。
此處我的端口沒有修改,默認9000,所以沒有配置。
文章來源:劉俊濤的博客歡迎關注公眾號、留言、評論,一起學習。
若有幫助到您,歡迎點擊推薦,您的支持是對我堅持最好的肯定(*^_^*)