dunglas / symfony-docker

A Docker-based installer and runtime for Symfony. Install: download and `docker compose up`.
https://dunglas.dev/2021/12/symfonys-new-native-docker-support-symfony-world/
2.59k stars 771 forks source link

PHP message: Xdebug: [Step Debug] Could not connect to debugging client. #485

Closed vhb-Mark closed 1 year ago

vhb-Mark commented 1 year ago

Hi all,

I followed the steps on the xdebug.md but as soon as I start the project with Xdebug my log is spammed with the following: NOTICE: PHP message: Xdebug: [Step Debug] Could not connect to debugging client. Tried: 172.21.0.1:9003 (through xdebug.client_host/xdebug.client_port, from xdebug://gateway)

Did I forgot something?

With kind regards

bkosun commented 1 year ago

Hello!

It looks like you have one of the unsuccessful use cases: https://github.com/xdebug/xdebug/pull/833#issuecomment-1123088191

This error appeared after the PR #461 merge. As you can see from the draft, xdebug://gateway is still not well tested: https://docs.google.com/document/d/1W-NzNtExf5C4eOu3rRQm1WlWnbW44u3ANDDA49d3FD4

To fix this bug, use xdebug.client_host = host.docker.internal instead of xdebug.client_host = xdebug://gateway

https://docs.docker.com/desktop/networking/#i-want-to-connect-from-a-container-to-a-service-on-the-host

As far as I understand, the previous configuration method worked regardless of the platform: https://github.com/dunglas/symfony-docker/blob/d620a5102a18cb90da73b9ee7934b29f4e380311/frankenphp/conf.d/app.dev.ini#L1-L2 https://github.com/dunglas/symfony-docker/blob/d620a5102a18cb90da73b9ee7934b29f4e380311/docker-compose.override.yml#L22

Official guide to setting up Xdebug 3 + Docker + PHPStorm from the author of Xdebug: https://www.youtube.com/watch?v=4opFac50Vwo