Macos解决VsCode无法调试PHP的问题
命令行,查看PHP配置文件位置:
php --ini
php.ini 内容:
zend_extension = /PATH/xdebug-3.4.0beta1/modules/xdebug.so
[xdebug]
xdebug.mode=debug
xdebug.start_with_request=yes
xdebug.client_host=localhost
xdebug.client_port=9000
xdebug.idekey="netbeans-xdebug"
vscode项目的 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": "Launch built-in server and debug",
"type": "php",
"request": "launch",
"runtimeArgs": [
"-S",
"localhost:8000",
"-t",
".",
"${file}",
"-dnetbeans-xdebug"
],
"port": 9000,
"serverReadyAction": {
"action": "openExternally"
}
},
{
"name": "Debug current script in console",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"externalConsole": false,
"port": 9000
},
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 9000
}
]
}
原因分析:
- “port” 和 php.ini 中一致;
- “runtimeArgs” 中,“${file}”, “-dnetbeans-xdebug”,是必须的。
Macos解决VsCode无法调试PHP问题
2332

被折叠的 条评论
为什么被折叠?



