Drupal-7: Debugging Drush commands with PHPstorm

Usually, when debugging Drupal code with PHPstorm, you set a header cookie and this sends control to Xdebug and PHPstorm. However, when debugging Drush commands, the PHP CLI interpreter is used, so a different system is needed. This tip comes from Lullabot's article on debugging Drush commands with Xdebug and PHPStorm. There are two ways to trigger PHPstorm: First, to allow PHPstorm to debug every time the CLI is invoked, set the idekey variable in the php.ini file, by adding the line: xdebug.idekey="PHPSTORM"; The second and more temporal method is to set the environment variable XDEBUG_CONFIG in bash using this command: export XDEBUG_CONFIG="idekey=PHPSTORM"
12 / 2019