xDebug Documentation
- Dominant language
- PHP
- Stars
- 4.5k
- Forks
- 652
- PR merge metrics
- No merged PRs in 30d
Description
#### ISSUE TYPE
- Documentation
#### SUMMARY
Ambiguity with xDebug on Docker Toolbox setup
#### Goal
To get xDebug working properly on Docker Toolbox, & clarify the docs to make it easier for others.
****
I've been struggling for several hours, still unsuccessfully, to get xDebug working on Docker Toolbox, based on the docs here: https://devilbox.readthedocs.io/en/latest/intermediate/configure-php-xdebug/toolbox/vscode.html.
1) The first confusion was with the 'Prerequisites': it mentions that you need to forward host port 9000, but then gives two different links. Which should we use? I believe the answer is that you can choose either one (based on https://github.com/cytopia/devilbox/blob/master/docs/advanced/connect-to-host-os.rst#id6). That clarification would help.
2) Since I'm on Windows & don't have an SSH server running, I went with https://devilbox.readthedocs.io/en/latest/howto/docker-toolbox/ssh-port-forward-on-host-to-docker-toolbox.html. I launched the QuickStart Terminal & entered the example command - after which it prompts for the "docker" user's password. What should we use? After more digging around, I found that you should use the key like: ssh -R 9000:127.0.0.1:9000 docker@192.168.99.100 -i .docker/machine/machines/default/id_rsa. Having that in the example docs would've saved time.
3) As for actually getting it working...it still isn't, so there must be something I'm still missing/misunderstanding from the instructions. As an initial proof-of-concept though, I *CAN* get xdebug it working (hitting breakpoints) with php.ini like:
> xdebug.default_enable = 1
> xdebug.remote_enable = 1
> xdebug.remote_connect_back=0
> xdebug.remote_log=/var/log/php/xdebug.log
> xdebug.remote_host=(the actual IP of my host machine, i.e. 192.168.1.xx)
This proves that xdebug is fundamentally on, path mapping is correct, there's no firewall in the way, etc. However, when I change `xdebug.remote_host=docker.for.lin.host.internal`, the logs always show:
> I: Connecting to configured address/port: docker.for.lin.host.internal:9000.
> E: Could not connect to client. :-(
This makes me think it's still something related to port forwarding. I also tried going into the VirtualBox machine's settings->Network->Adapter 1 (nat)->Advanced->Port Forwarding & added port 9000, but it didn't help. I tried some other setups found by digging around elsewhere - i.e. using IP 10.0.2.2 instead of docker.for.lin.host.internal - but nothing seemed to work.
Obviously hardcoding my host PC's current IP isn't a long-term solution (it's a laptop that moves around & gets different IPs), but this is where I remain stuck. It works if I give php the direct IP...but not if I use docker.for.lin.host.internal.
Contributor guide
Assessment
This issue has not been assessed yet.