Open metal450 opened 5 years ago
Your are not the only person who encountered exactly the same issue. Xdebug and Docker is in my eyes really a pain, because of the xdebug.remote_host
. If your setup isn't running it's 99% chance that you choose the wrong ip. Ended also hardcoding it.
I will draft an PR on this with the information I currently have. Please be noted that I do not have a Windows machine to test with, so I will rely on the information provided.
Hope we can get this right and well documented this time.
Great, thanks - looking forward to hopefully getting it working :)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Bumping to keep the issue from closing. Still unable to configure xdebug without hardcoding my PC's actual IP address.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
...Still no solution (4mo later), so no, this should not be marked as stale.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
...Still no solution (6mo later), so no, this should not be marked as stale.
i've experienced a similar issue, the only way i've got xdebug working, is putting the local ip in to the my overriden "xdebug.ini"
With xdebug 3 the documentation really needs a refresh. Would like to help but I am still not able to configure it on linux.
Has somebody bean able to configure devilbox using xdebug 3 using PphStorm on linux ?
After 6 hours of tries I finally manged to run xDebug. All CREDIT GOES TO https://github.com/cytopia/devilbox/issues/628#issuecomment-634518897 helpful soution
Config: Devilbox v1.9.2 latest as of today apache2.4 php7.3
cd devilbox/cfg/php-ini-7.3 touch xdebug.ini vim xdebug.ini
Copy the following content into newly created file, its copied from devilbox-php.ini-xdebug file in the same folder
xdebug.mode = debug xdebug.start_with_request = yes xdebug.remote_handler = dbgp xdebug.remote_port = 9000 xdebug.idekey = PHPSTORM xdebug.remote_log = /var/log/php/xdebug.log
; This is the REQUIRED extra bit PHPStorm hints you to add this in php.ini xdebug.client_host = 172.16.238.1
Ensure DBGp proxy settings are configured in PHPStorm Note the Host IP
Basically the devilbox docs says to put 0.0.0.0 in the host, you actually have to put the external_host IP of php image
That's It, Happy debugging.
You can add browser specific debuger plugin as well (Optional) link: https://www.jetbrains.com/help/phpstorm/browser-debugging-extensions.html
@ARehmanMahi hello, I installed PHPStorm and tried to follow your suggestions, but still I cannot make it work... maybe I am missing something trivial, but still cannot figure it out.
xdebug.mode = debug
xdebug.start_with_request = yes
xdebug.remote_handler = dbgp
xdebug.client_host = 172.16.238.1
xdebug.remote_port = 9000
xdebug.idekey = PHPSTORM
xdebug.remote_log = /var/log/php/xdebug.log
Once I access my project on the browser via https://mytest.loc no breakpoint get triggered.
@masiorama xdebug.ini must contain xdebug.client_host = 172.16.238.1
I don't see that in your provided gist.
Also in my answer step 3, make sure you have enabled start listing, the green telephone icon.
P.S. I've ubuntu install locally, and all the docker stuff was experimental stuff for me, and it turned out to be more hassle then improvement, I Installed LAMP stack and am very happy now, I also do manage my own VPN for testing and stuff with clean lamp stack, works perfect for me. Like PHPStorm does't support remote NodeJS the way it does php/xdebug. I needed that for my JS validation plugin. The mainter of this repo rarely reply and is only contributor so its kind of a dead project for me. End of rant. Good luck
Hi @ARehmanMahi, actually the ip is there... Or you mean something different?
I also triggered the Start Listening button.
You mean that you are using a LAMP stack instead of the devilbox env?
Thanks!
@masiorama yeah, my bad, you have the IP there, by the way I noticed you are using the vwsl linux on windows. I'm actually on ubuntu, and Yes I'm using lamp stack instead of docker. Its way easier and customiseable than devilbox once set correctly.
P.s. On windows Laragon is The Best I've had used. (PHP, wordpress, laravel and more)
@ARehmanMahi exactly, I'm on wsl2 (ubuntu + docker + devilbox). Thanks for the infos, but I'd like to stick to devilbox since I use it from the beginning (I believe 4 years) and it really suits my flexibility needs... If I could solve this debug issue it would be perfect for me.
I managed to make it work with Win10 + WSL2 (Ubuntu 20.04): inside WSL2 I installed docker, docker-compose and devilbox. I can debug from VSCODE installed on Win10.
I managed to make it work with Win10 + WSL2 (Ubuntu 20.04): inside WSL2 I installed docker, docker-compose and devilbox. I can debug from VSCODE installed on Win10.
Hi @masiorama ,
I am trying to do the same.
Can you please provide a guide on how you did it?
Thanks in advance.
Hi @geeksupport1, sure, I will help you if I can. What did you accomplished so far? Where are you stuck at the moment?
I wrote a complete guide in 6 steps/pages on my website, but it is in italian. Here you can find the step related to xDebug: https://www.masiorama.it/news/come-preparare-un-ambiente-di-sviluppo-php-completo-su-windows-10-wsl2-docker-devilbox-xdebug-step-5
Let me know if you can follow it.
Hi @masiorama,
Thanks for the link.
I think devilbox is great if you have a linux machine,
But on WSL2, as the founder does not use WSL2 there will continue to be problems.
After trying it for 2 days, I gave up.
I followed https://docs.microsoft.com/en-us/shows/beginners-series-to-dev-containers/[https://docs.microsoft.com/en-us/shows/beginners-series-to-dev-containers/](https://docs.microsoft.com/en-us/shows/beginners-series-to-dev-containers/) and got it working for WSL2, docker, VScode within 1 hour.
The VSCode tooling does all the config for you and a directory and creates 2 files to make it work: .devcontainer/
Things are changing fast.
Just to mention, I work with xdebug on wsl2+devilbox without issues.
Thanks,
Can you outline the setup in a wiki some where.
I could not get it to work.
On Tue, 3 Jan 2023, 5:31 pm masiorama, @.***> wrote:
Just to mention, I work with xdebug on wsl2+devilbox without issues.
— Reply to this email directly, view it on GitHub https://github.com/cytopia/devilbox/issues/575#issuecomment-1369462502, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALCJZLFILDC227FHBONEGTWQPIWJANCNFSM4HLCRVPA . You are receiving this because you commented.Message ID: @.***>
Let's continue in the aggregated thread here: #946
ISSUE TYPE
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:
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: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.