I spent a bit of time to understand how Xdebug3.1.6 work in PHP8.1, the following is the UML sequence diagram for my understanding of Xdebug.
Some notes
- In a Docker container, you need to tell Xdebug where to make the debugging connection to, as it is Xdebug that initiates the communication to the IDE, and not the other way around.
- If we set `xdebug.start_with_request=yes` in 99-xdebug.ini, every request will trigger a debugging session.
- Set `xdebug.log=/tmp/xdebug.log` in the `99-xdebug.ini`, you can always check the log info to know what’s going on for the xdebug, go to container run `cat /tmp/xdebug.log`