

choose “Connect to existing container” instead of starting a new one.choose Docker Compose Configuration files in my case I choose two in following order:.select or create new Server (use Unix socket to connect to Docker daemon).in new window add a new interpreter “From Docker, Vagrant, VM, Remote…”.in your PhpStorm Settings go to Languages and Frameworks > PHP and click the ‘…’ button near the “CLI Interpreter” field.I will not describe the whole Run/Debug configurations topic here but only one Docker-specific aspect: you need to teach your PhpStorm to run PHP interpreter inside your container.įor this you need to create a new PHP CLI interpreter configuration: Finally, load your local sites home and watch how PhpStorm will. Also ensure that PhpStorm is still set to listen to incoming Xdebug connections. Then, using the Xdebug Helper extension, enable debugging. Sometimes it is useful to create and store some specific configuration so you can run it over and over. Give it a try At this point, we should be ready for debugging As a test, open up the sites index.php in PhpStorm and place a breakpoint. Creating Run/Debug configurations in PhpStorm If you don’t like this approach, just disable the autostart and start the session your own way (see: Activate debugger). I believe this still adds a small overhead in time for all requests, but for me it is unnoticeable. So when I don’t need to debug, I just switch listening off. The case is that when XDebug tries to start the debugging session but the remote host is not listening, the XDebug does not continue.

However I found it convenient to enable autostart and only control the XDebug via PhpStorm. Normally you would need a browser extension, which adds debug session start flag to your requests when you need it. One important thing you need to do is to start listening for PHP debug connections with a small phone icon in your PhpStorm.
#Phpstorm xdebug docker code
Host/Port: whatever host and port you use to open your local website, for example: ‘magento.localhost’ and ‘8080’.Ĭonfigure the path mapping according to your source code volume mount in docker-compose.yaml.In your PhpStorm Settings go to Languages and Frameworks > PHP > Servers and add a new server: This will tell your PhpStorm which server configuration to use.

