我正在docker容器中运行laravel项目,并且正在使用vs代码调试该项目。
我有一个配置完美的launch.json。
如果我运行docker exec -it main bash
,则会显示以下pathMappings。
{
"version": "0.2.0",
"configurations": [
{
"name": "main",
"type": "php",
"request": "launch",
"pathMappings": {
"/home/virta/site/trunk": "/Users/masnadnehith/Desktop/bitbucket/main/"
},
"xdebugSettings": {
"max_data": 65535,
"show_hidden": 1,
"max_children": 100,
"max_depth": 5
},
"port": 9000
}
]
}
现在我有一个新的项目laravel项目,该项目是我使用git克隆并添加到名为“ main core
”的“ main”目录中的子模型,但我遇到的问题是现在{{1} }根本无法运行调试器。
所以现在我创建了第二个这样的配置。
main core
docker exec命令用于获取新容器的pathMapping。
因此,我不确定为什么第一个配置可以完美地调试laravel项目,而第二个配置却不能正常工作。 第二个使用不同的docker容器(btw)。 第一个在没有安装任何扩展程序的情况下工作。
Php信息已经显示调试器已安装。
下面的xdebug文件
{
"version": "0.2.0",
"configurations": [
{
"name": "main",
"type": "php",
"request": "launch",
"pathMappings": {
"/home/virta/site/trunk": "/Users/masnadnehith/Desktop/bitbucket/main/"
},
"xdebugSettings": {
"max_data": 65535,
"show_hidden": 1,
"max_children": 100,
"max_depth": 5
},
"port": 9000
},
{
"name": "main-core",
"type": "php",
"request": "launch",
"pathMappings": {
"/var/www": "/Users/masnadnehith/Desktop/bitbucket/main/main-core"
},
"xdebugSettings": {
"max_data": 65535,
"show_hidden": 1,
"max_children": 100,
"max_depth": 5
},
"port": 9000
},
]
}
答案 0 :(得分:1)
与其直接使用路径映射端口,不如使用workspaceroot\main-core
"pathMappings": {
"/var/www/": "${workspaceRoot}/main-core"
}