Visual studio code PHP调试在使用Xdebug的VSCode中不起作用
以下是我的启动配置:Visual studio code PHP调试在使用Xdebug的VSCode中不起作用,visual-studio-code,xdebug,Visual Studio Code,Xdebug,以下是我的启动配置: { // 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", "configu
{
// 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
}
]
}
下图显示了我得到的错误
您正在使用Apache吗?您是否尝试将x-debug扩展添加到apache设置中 将以下行放在php.ini文件中:
[xdebug]
zend_extension="c:/wamp64/bin/php/php7.2.10/zend_ext/php_xdebug-2.6.1-7.2-vc15-x86_64.dll"
xdebug.remote_enable = 1
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 1
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir ="c:/wamp64/tmp"
xdebug.show_local_vars=1
xdebug.remote_port = 9001
然后将配置文件中的端口更改为“port”:9001
ps:你应该下载一个兼容版本的x-debug并将其放在php的ext文件夹中。我正在使用Ubuntu系统。ubuntu中zend_扩展的路径是什么?zend_扩展是针对PHP而不是ubuntu的,我想你可以在这里找到一个很好的解释: