bitpressio / docker-for-php-developers-errata

Reported errata for https://bitpress.io/docker-for-php-developers/
13 stars 0 forks source link

xdebug is not working on both mac and windows #26

Open lamouf opened 4 years ago

lamouf commented 4 years ago

Hi Paul, I followed the exact steps in the two videos dedicated to xdebug.

Xdebug is not working in both mac and windows Please help.

paulredmond commented 4 years ago

Hi, in order to help you can you share a public GitHub repo with your code?

lamouf commented 4 years ago

Hi, Thanks for you response. you will find the repo at : https://github.com/lamouf/laravel-xdebug.git

i added few images that can be helpful into readme.md. Thanks

paulredmond commented 4 years ago

@lamouf looks like it might be the quotes around the IP address:

# Your repo, docker-compose env will include the double quotes as part of the value.
PHP_XDEBUG_REMOTE_HOST="192.168.0.104"

# The correct configuration should be:
PHP_XDEBUG_REMOTE_HOST=192.168.0.104

You might also want to try this on Mac/Windows too:

PHP_XDEBUG_REMOTE_HOST=host.docker.internal

I am on a Mac, but looking at the Windows documentation, the host.docker.internal should work.

paulredmond commented 4 years ago

Verified your repo works for me after adjusting that env value:

image
paulredmond commented 4 years ago

Here's a visual of debugging the remote host env value included quotes (") inside the app container:

image

Then after I adjusted them to work for me, here's the value without quotes as PHP INI would expect it:

image
paulredmond commented 4 years ago

I would also recommend setting PHP_XDEBUG_REMOTE_AUTOSTART=0 when you have schedulers and queues running, and use a browser extension to only start xdebug on the web application.

lamouf commented 4 years ago

Great job Paul, Thanks a lot for your priceless help. i works like a charm !! Cheers.