Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
These changes enable XDebug PHP debugging using VSCode + PHP Debug extension.
I used a number of instructions/tidbits from the internet to figure out how to get this working. Most of the documentation on the internet refers to XDebug 2 configurations, however we are running XDebug v3 which has different configuration options.
In addition, for this to work, the XDebug program running inside Docker needs to connect to VSCode on the host, port 9003. Normally services running inside Docker don't need the ability to connect to services running on the host, however XDebug is a different kind of animal and needs this ability.
I added the
extra_hosts
in docker-compose to make this possible. This requires Docker v20.10 or later to use the specialhost.docker.internal
hostname.Some additional notes on debugging PHP using VSCode and XDebug:
VSCode allows you to break on 'everything'. I suggest turning this off so that the debugger doesn't break inside composer dependencies by default.
XDebug can probably safely be included in the production build since it defaults to "off". If we create a separate app build for production, then XDebug can be omitted entirely.
This change is