
Even if you do it by choice and not because you lack knowledge. From my perspective, there is nothing wrong with that. So, why is this so important? A recent research from JetBrains shows that 68% of the PHP developers debug their code using var_dump(), die(), dd() and dump(). Now, I would like to share how we can build upon our previous Dockerfile in a way that Xdebug can run directly from Docker and also connect it with Visual Studio Code.īy choosing this approach, we substantially reduce the amount of setup that each team member has to do on their machine to get the project up and running, which means that we can start writing code faster.

This Xdebug config works for debugging in FPM context: cat xdebug.In my last post, I've talked about how to configure a development environment and how it extends a Dockerfile made for production.

With Xdebug v2.9.6, Copyright (c) 2002-2020, by Derick Rethans Zend Engine v3.3.18, Copyright (c) 1998-2018 Zend Technologies

Now I need to debug a CLI script and PhpStorm shows me following error: Cannot evaluate expression '$_SERVER'

Once I'm in FPM context - I can debug things fine if I just have activated remote debugging in PhpStorm. My php 7.3 interpreter with Xdebug sits inside one of those containers. I'm running Docker Desktop for Windows in WSL2 mode. I'm running a Magento2 PHP app inside a set of docker containers that are orchestrated by docker-compose locally.
