Suppossing you have followed into the instructions mentioned into the following links:
- Can't connect PhpStorm with xdebug with Docker
- How to setup Docker + PhpStorm + xdebug on Ubuntu 16.04
Or similar questions
Then you need to follow theese steps:
Step1: Get shell access to your container via running:
docker exec -ti ^container_id^ /bin/sh
Or if running a debian/ubuntu based one (or you installed manually bash):
docker exec -ti ^container_id^ /bin/bash
The ^container_id^ can be found via docker ps command it is the first column of the table. If running on a small window just pipe int into less -S resulting the command:
docker ps | less -S
Then export the following enviromental variables:
export PHP_IDE_CONFIG="serverName=0.0.0.0:5092"
export XDEBUG_CONFIG="idekey=PHPSTORM"
Please keep in mind to setup the correct value specified into Servers section as you see in the image:

It is important in order not to run into the problem specified in this question.
Then just enable debugger listentin into the phpstorm and spawn the cli as you do when you run a symfony application.
Answer from Dimitrios Desyllas on Stack Overflowphp - Debug Symfony CLI application with PhpStorm inside Docker container - Stack Overflow
XDebug not working with PhpStorm
How to use xDebug with Symfony?
XDebug and Docker
Videos
Hello fellow developers! 👋
I'm currently on a quest to set up xDebug with Symfony, and I must admit, it has been quite a challenging journey so far. I've scoured through over 20 blogs, numerous articles, and of course, the official documentation of both Symfony and PhpStorm. Despite my best efforts, success seems to be eluding me. 😞
I'm operating on PHP 8.2 and my project is based on Symfony 6.3. Here’s a rundown of the configurations and steps I’ve taken:
-
PHP Interpreter: Ensured that Symfony is utilizing the correct PHP interpreter.
-
xDebug Settings: I’ve stuck with the default settings here.
-
DBGp Proxy: Configured as needed.
-
Servers: Set up according to instructions.
-
php.ini Configuration: Checked and rechecked (using "php --ini") to make sure that Symfony is loading the correct php.ini file located at /etc/php/8.2/cli/php.ini.
-
Debug Toolbar: Installed and configured.
-
Chrome Extension: I’ve also installed the xDebug helper extension for Chrome.
-
Breakpoints: Set at various points in my code to test the debugging process.
My configuration:
php interpreter
making sure symfony uses the correct interpreter
xDebug settings (default)
DBGp
server settings
/etc/php/8.2/cli/php.ini (made sure via "php --ini" this is the loaded .ini)
debug toolbar
xDebug helper chrome extension config
breakpoint
After meticulously going through these steps, I hit a roadblock. When I refresh the page in my browser, expecting the magic of debugging to happen, nothing occurs. No stops at breakpoints, no error messages - just silence.
I’m left here wondering, what could possibly be missing or misconfigured? Is there a hidden step that I’ve overlooked? Why does setting up a debugger for PHP have to be such a complex task?
If any of you kind souls have been through this ordeal and emerged victorious, your wisdom would be greatly appreciated. I’m all ears for any tips, tricks, or insights you might have to share!
Thank you in advance for your time and help! 🙏
So here is the solution:
-
install php-fpm don't use the php-cli in combination with symfony cli
-
delete all servers in the PHPStorm settings
-
set a breakpoint and refresh the page
-
let it create the server config automatically then just add the "Absolute path to the server" for example /home/username/apps/myapp
-
???
-
profit