How does Xdebug 3 work with PHP 8

Aaron Ji
Jul 8, 2023

--

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.

UML sequence for understanding connection between Xdbug and PHP 8

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`

--

--

Aaron Ji

Diligent software engineer with 10+ years experience in commercial application development with a real appetite for learning and growing.