Configuring XDebug


php with xdebug is can be set for local, by changing $PROJECT_IMAGE variable to xdebug in corresponding .env files, ensuring corrent docker image to be used.

Debugger settings in PhpStorm IDE

Now to set the PhpStorm, go to:

Preferences > Languages & Frameworks > PHP > Debug

In this window check the following settings:

  • Xdebug section, set port 9111

  • “Can accept external connections” is checked

  • “Ignore external connections through unregistered server configurations” is checked

  • Other settings is up to your preferences of the debugger

Now we need to set up a server configuration, to map local files to remote application container, head to:

_Languages & Frameworks > PHP > Debug > Servers__

  • Add new configuration by clicking the + symbol

  • Host:

  • Port: 3001, which is default nginx port, try to avoid using varnish port and disable varnish in magento configuration during debug sessions

  • Debugger: Xdebug

  • And map your local ./src/ directory to remote /var/www/public

Setting up IP alias

To allow connections from container to debug console in PhpStorm you need to add following alias to you system, this setting is not persisted between restarts, update your env accordingly


sudo ip address add dev docker0


sudo ifconfig en0 alias

Now the configuration is complete, happy debugging!

Last updated