I just wanted to document my settings here for getting xDebug to run in Visual Studio Code with Lima (on OSX)
I’m running xDebug version 3.x.x
For my launch.json I have the following config block for “Listen for debug”
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"stopOnEntry": true,
"port": 9003,
"pathMappings": {
"/srv/www/projectname.com/current": "${workspaceFolder}/site"
}
}
"stopOnEntry":
can also be set to false
depending on what you want. I sent it to true
to just initially test it was working but then turned it to false
.
Then I need to align the ide_key of vscode to that of my browser plugin which is the xDebug Chrome Extension (https://chromewebstore.google.com/detail/xdebug-chrome-extension/oiofkammbajfehgpleginfomeppgnglk)
You can find the value VSCode is expecting in this settings variable php.debug.idekey
and for me it is set to vsc
. You then need to update this in the Chrome extension settings to match. Mine was originally set to PHPSTORM
.
Once this is all done, activate “Debug” mode in the Chrome extension, start the debugger and reload the page in the browser.
I hope this is useful to someone.