我用VScode编写了一个PHP/Laravel代码。
Laravel的版本是6.20
我想使用断点并检查变量和数组的值。
我试图安装名为Xdebug的扩展。
我点击了三角形按钮。
当应用程序启动时(php服务),它似乎停止在我放置的断点。但是,调试控制台显示。
Failed initializing connection 1: connection closed (on close)
我想知道使用允许断点的调试工具的步骤。
launch.json
"version": "0.2.0",
"configurations": [
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 8000
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"port": 0,
"runtimeArgs": [
"-dxdebug.start_with_request=yes"
],
"env": {
"XDEBUG_MODE": "debug,develop",
"XDEBUG_CONFIG": "client_port=${port}"
}
},
{
"name": "Launch Built-in web server",
"type": "php",
"request": "launch",
"runtimeArgs": [
"-dxdebug.mode=debug",
"-dxdebug.start_with_request=yes",
"-S",
"localhost:0"
],
"program": "",
"cwd": "${workspaceRoot}",
"port": 9003,
"serverReadyAction": {
"pattern": "Development Server \\(http://localhost:([0-9]+)\\) started",
"uriFormat": "http://localhost:%s",
"action": "openExternally"
}
}
]
发布于 2022-11-04 11:32:44
在您的情况下,我不太清楚它为什么要关闭调试连接。
但是,您可以尝试的只是开始使用dockerized环境。看起来不错。我写了一个关于如何设置它的教程。有一些特定于Windows的细节,但它也应该在Mac上工作。希望它能帮助https://blog.devsense.com/2022/laravel-on-docker
https://stackoverflow.com/questions/72675422
复制相似问题