I'm working with a Magento 2 queue at the moment. To debug Magento 2 console scripts I normally just hit 'listen to external connections' in PHPstorm and execute the CLI script (i'm using Valet+ with Xdebug on Mac).

With the new queue system of Magento 2.3 this, however, doesn't work. When I start my normal debugging workflow and I start queue processing with bin/magento queue:consumers:start someConsumer and PHPstorm stops at the first line of \Magento\MessageQueue\Console\StartConsumerCommand::execute:

Xdebug session with PHPstorm

But it never reaches my actual consumer class. In my case this is Vendor\Module\Model\Queue\Consumer::processMessage (as specified in queue_consumer.xml). The processMessage function is executed, and the breakpoints aren't hit.

So, how do I setup Xdebug to debug queue consumers in Magento 2.3?

2 Answers 2


First verify XDebug is enabled for CLI PHP:

php -i | grep xdebug

Set these environment variables in the (SSH) shell of the Magento instance, you may need to change the port and host:

export PHP_IDE_CONFIG="serverName=Local_Mac"
export XDEBUG_CONFIG="remote_enable=1 remote_mode=req remote_port=9000 remote_host= remote_connect_back=0"

Now you can execute CLI commands which will use the above XDebug settings:

php bin/magento queue:consumers:start

Or you can start a specific consumer, for example exportProcessor:

php bin/magento queue:consumers:start exportProcessor

I'm just extend the answer of Jeroen Vermeulen - MageHost

export PHP_IDE_CONFIG="serverName=Local_Mac"

Where 'Local_Mac' is name of settings in phpstorm PHP/Servers/Name (isn't a virtualhost or etc.)

export XDEBUG_CONFIG="remote_enable=1 remote_mode=req remote_port=9003 remote_host= remote_connect_back=0"

remote_port=9003 for xDebug 3.x

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.