Has anyone has success with getting CLI debugging (drush) working with Xdebug 3.x? There are several obsolete posts here... but all obsolete with the new version of Xdebug.

Expected behavior

After setting a breakpoint in a PHP class or module, that I know is executed when a specific Drush command is run, I would like PHPStorm to stop at the breakpoint.

Debugging when initiated from the browser works beautifully. Drush - nothing. Though it used to before I;

  1. upgraded to Catalina
  2. upgraded Xdebug from 2.x to 3.x


Local MAMP Drupal 8 / Drush 9.7.2


PHP 7.4.13 (cli) (built: Nov 30 2020 14:46:04) ( NTS ) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies with Zend OPcache v7.4.13, Copyright (c), by Zend Technologies

1 Answer 1


I am guessing that you have changed your xdebug.ini according to the new standards. (Port changed from 9000 to 9003 etc...)

If not you should do that first. Check this link for additional information on the matter.

Besides that considering that you are using phpstorm, you should simply run


before running the drush command. This must be done once every time you open a new terminal session. (Not sure if there is a way to have it permanently and if there is i am not sure you want it.) Nevertheless, if your configurations are ok, this should work.

Best Regards.

  • 1
    Thank you. Just a comment or two. First, I don't think there is an xdebug.ini. According to the docs, the config will more likely be in php.ini Also, in my case there was/is some configuration in .bash_profile. Once I got the debugger to trigger, I saw another error referencing an old virtual host that I'm not using. Fixed it with export PHP_IDE_CONFIG="serverName=myhost-www.localhost"
    – sea26.2
    Commented Jan 27, 2021 at 16:58
  • 1
    @sea26.2 – Can you maybe add another answer as well, with all the steps you did to fix it in the end?
    – leymannx
    Commented Jan 27, 2021 at 20:37
  • Hey again, there is no xdebug.ini indeed, but any *.ini file you create will add up to your php configurations and it is advised to use separate files (At least I prefer it that way) to declutter the main php.ini file a bit. Commented Jan 28, 2021 at 21:06

Your Answer

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

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