wardenenv / warden

Warden is a CLI utility for orchestrating Docker based developer environments
https://warden.dev
MIT License
411 stars 169 forks source link

XDebug on WSL2/Ubuntu 18.04 #212

Closed cch99 closed 4 years ago

cch99 commented 4 years ago

Warden works well using Windows Subsystem for Linux 2 (WSL2). I'm able to edit the files just fine in Windows/PHPStorm and the changes are reflected in the container. This is a really good solution for Magento 2 development on Windows. I've read through the documentation and have spent quite a bit of time trying to get xdebug to work in this environment without any luck. Is there any more detailed info on using xdebug with the warden environment?

ihor-sviziev commented 4 years ago

Hi @zoid99, EDIT: For now as a workaround you could add following lines to your .env file:

XDEBUG_CONNECT_BACK_HOST=host.docker.internal
WARDEN_ENV_DEBUG_HOST=host.docker.internal

I created PR https://github.com/davidalger/warden/pull/213 that adds compatibility with wsl2.

Elamurugan-Nallathambi commented 4 years ago

@here @davidalger @cch99 @ihor-sviziev Please can you share if there is any particular steps I should follow to get this working with Windows 10 1909 + WSL2 with Ubuntu + Warden docker toolchain of services? This will be really helpful.

ihor-sviziev commented 4 years ago

@Elamurugan-Nallathambi I've set it up long time ago, unfortunately don't have any instructions. If you have any specific questions or something doesn't work for you - let me know

cch99 commented 4 years ago

@Elamurugan-Nallathambi I have not been successful getting XDebug running with Warden/WSL2. I think I'm close but the php-fpm xdebug container doesn't seem to be connecting back to my PHPStorm instance. If I can get time try again and I get running I'll write up a quick howto.

ihor-sviziev commented 4 years ago
  1. Please update warden to latest version, we just had few related fixes recently
  2. Are you running windows version of phpstorm or Linux version inside VcxSrv? If second option - you need also to forward 9000 port to the Linux, here is instruction https://github.com/microsoft/WSL/issues/4150#issuecomment-504209723
cch99 commented 4 years ago

@ihor-sviziev I got this working and it's a game changer. Windows version of PHPStorm. I believe it was the update to the latest warden that did the trick. This is my first experience using xdebug with php. In the past I've always used echo and print_r, var_dump but that doesn't work very well with Magento 2 and the events. Plus the objects are so large in Magento 2 that php runs out of memory if you try to use those methods.
Thanks again! Chris

lightman1990 commented 2 years ago

Hello @davidalger and the rest so I am experiencing this same issue on 0.12.0 and wsl2. Everything else is working great but I cannot get the Xdebug to work. I have done all of the steps in the https://docs.warden.dev/configuration/xdebug.html but it is still not doing anything. I have PHPSTORM installed on Windows11 and am trying to use the Xdebug but its just not passing through from the wsl/docker back to Windows PHPSTORM. I have not added anything to hosts file of Windows 11 except the 127.0.0.1 mywebsite.test that makes it work in chrome and that is fine. I have installed Chrome plugin for Xdebug and double checked that cookie is being added to the browser PHPSTORM. I do not know what am I missing. I will keep on digging but any suggestion is helpful. Thank you!

lightman1990 commented 2 years ago

Hello @davidalger and the rest so I am experiencing this same issue on 0.12.0 and wsl2. Everything else is working great but I cannot get the Xdebug to work. I have done all of the steps in the https://docs.warden.dev/configuration/xdebug.html but it is still not doing anything. I have PHPSTORM installed on Windows11 and am trying to use the Xdebug but its just not passing through from the wsl/docker back to Windows PHPSTORM. I have not added anything to hosts file of Windows 11 except the 127.0.0.1 mywebsite.test that makes it work in chrome and that is fine. I have installed Chrome plugin for Xdebug and double checked that cookie is being added to the browser PHPSTORM. I do not know what am I missing. I will keep on digging but any suggestion is helpful. Thank you!

Disregard guys I figured it out it was mea culpa. Do not know how was missing PHP_XDEBUG_3=1 in the .env and hosts files had commented out docker '192.168.0.13 host.docker.internal 192.168.0.13 gateway.docker.internal' & after I rechecked all configs it took me 15 minutes to realize I might need to restart warden svc so I ran warden env down and warden svc restart and it started working.