سؤال

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

Environment:

Local MAMP Drupal 8 / Drush 9.7.2

PHP

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

هل كانت مفيدة؟

المحلول

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

export XDEBUG_SESSION=PHPSTORM

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى drupal.stackexchange
scroll top