-
Notifications
You must be signed in to change notification settings - Fork 41
1.6 Debugging
Tim edited this page Feb 26, 2023
·
1 revision
Install Chrome Xdebug plugin.
https://chrome.google.com/webstore/detail/xdebug-helper/eadndfjplgieldjbigjakmdgkmoaaaoc?hl=en
Config in Lagoon
-
Enable DOCKERHOST in .env.
# Enable static dockerhost DNS DOCKERHOST=host.docker.internal
-
Rebuild docker images
ahoy build cli or ahoy build
-
Enable Xdebug in docker image
ahoy debug
Configure Visual Studio Code
- Install the PHP Debug extension by Felix Becker.
- Follow the instructions to create a basic
launch.json
for PHP. - Add correct path mappings. For a typical GovCMS SaaS project, an example would be:
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 9000,
"hostname": "localhost",
"pathMappings": {
"/app/config": "${workspaceFolder}/config",
"/app/web/sites/default/files": "${workspaceFolder}/files",
"/app/web/themes/custom/custom": "${workspaceFolder}/themes/custom"
}
// "stopOnEntry": true,
// "log": true,
}
]
}
- In the Run tab of Visual Studio Code, click the green arrow next to “Listen for Xdebug”.
- Enable Chrome Xdebug plugin on the listening page
- Load a webpage or run a Drush command
Optional: Sync application folder out from cli image into workspace folder.
ahoy my sync-app
Mapping app folder in launch.json
pathMapping
entries.
"/app" : "${workspaceFolder}/app",