Skip to content

Instantly share code, notes, and snippets.

@app-js
Last active September 12, 2022 17:11
Show Gist options
  • Save app-js/c79cf8f99206c5239146a267c60c5dc2 to your computer and use it in GitHub Desktop.
Save app-js/c79cf8f99206c5239146a267c60c5dc2 to your computer and use it in GitHub Desktop.
Devilbox Xdebug V.3.x in PHP-Container or WSL for VSCODE
On Linux (or WSL) set 'host.docker.internal: host-gateway' in the PHP service in docker-compose.yml:
dns:
- 172.16.238.100
# MacOS and Windows have this by default, this hack also allows it for Linux
extra_hosts:
docker.for.lin.host.internal: 172.16.238.1
docker.for.lin.localhost: 172.16.238.1
host.docker.internal: host-gateway
networks:
app_net:
ipv4_address: 172.16.238.10
extra_hosts:
- "host.docker.internal:host-gateway"
Restart your services: docker-compose down && docker compose up -d
Set xdebug.client_host=host.docker.internal in xdebug.ini for debugging on the host:
;XDebug ab V.2.x
; xdebug.mode=debug
; xdebug.client_port=9000
; xdebug.remote_enable=1
; xdebug.remote_handler=dbgp
; xdebug.start_with_request=yes
; xdebug.idekey=VSCODE
; xdebug.show_error_trace = 1
; xdebug.max_nesting_level=250
; xdebug.var_display_max_depth=10
; xdebug.client_host=172.16.238.10
; xdebug.discover_client_host=1
;XDebug ab V.3
;Debugging im PHP Container
;xdebug.client_host = 172.16.238.10
;Debugging auf dem Host
xdebug.client_host=host.docker.internal
xdebug.mode = develop,debug
xdebug.client_port = 9003
xdebug.start_with_request = yes ; trigger Or use "yes" to launch XDebug on every request
xdebug.discover_client_host = false
xdebug.log_level = 7
xdebug.idekey=VSCODE
Launch on host:
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 9003,
"pathMappings": {
"/shared/httpd/info/htdocs": "${workspaceFolder}/data/www/info/htdocs",
"/var/www/default": "${workspaceFolder}/.devilbox/www",
}
},
Launch in the PHP-Container:
{
"name": "Listen for Xdebug",
"type": "php",
"request": "launch",
"port": 9003
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment