Debugging Magento CLI running in Docker container

To debug Magento CLI running in Docker container run the CLI command with following syntax: XDEBUG_CONFIG="remote_enable=1 remote_mode=req remote_port=9000 remote_connect_back=0 idekey=PHPSTORM" PHP_IDE_CONFIG="serverName=Docker" bin/magento

To understand better this construct, let's deconstruct it:

  • XDEBUG_CONFIG= tells interpret, that you're about to inject some variables
  • remote_enable=1 enables the remote debugging
  • remote_mode=req
  • remote_port=9000 port to listen (change if you use different one)
  • remote_connect_back=0
  • idekey=PHPSTORM IDE key to filter connections (change if you use different one)
  • PHP_IDE_CONFIG="serverName=Docker" enables PHPStorm to use specified server setting

You may also like

 16.5.2021
Unit testing Magento 1

Writing unit tests for Magento 1 running in Docker Container

 29.12.2022
XSD validation in your IDE

Validate your XML files against Magento 2 XSD schemas

 29.3.2022
Debugging Magento CLI running in Docker container

Debugging Magento CLI running in Docker container

 23.5.2023
An error "Missed phrase" during Magento 2 phrase collection

Exception during phrase collection

 5.4.2023
Magento release 2.4.6 - what's new

New release of Magento 2

 3.5.2023
Mailhog PHP sendmail path configuration

Sending mails from PHP within Docker with Mailhog

 5.7.2023
Our Pimcore 11 upgrade notes

What we learned during upgrading Pimcore 10.x to 11.x