1
votes

I have two Drupal codebases. On the first, I can hit a specific breakpoint through both the browser and through a drush command. On the second, I can hit the breakpoint only through the browser. The drush command finishes successfully without hitting the breakpoint. I can't find any meaningful difference between the two installations.

Local development on Windows 10 home
Docker toolbox
DDEV v1.14.2
Composer version 1.10.5
IDE is VSCode, launch.json file is identical between the two
Drush Launcher not installed

The good one:
c:...\d8-04-28>ddev exec drush status
Drupal version : 8.8.5
Site URI : https://d8-04-28.ddev.site
DB driver : mysql
DB hostname : db
DB port : 3306
DB username : db
DB name : db
Database : Connected
Drupal bootstrap : Successful
Default theme : bartik
Admin theme : seven
PHP binary : /usr/bin/php7.3
PHP config : /etc/php/7.3/cli/php.ini
PHP OS : Linux
Drush script : /var/www/html/vendor/drush/drush/drush
Drush version : 10.2.2
Drush temp : /tmp
Drush configs : /var/www/html/vendor/drush/drush/drush.yml
/var/www/html/drush/drush.yml
Install profile : standard
Drupal root : /var/www/html/web
Site path : sites/default
Files, Public : sites/default/files
Files, Temp : /tmp

The bad one
c:...\d8-06-08>ddev exec drush status
Drupal version : 8.8.5
Site URI : https://d8-06-08.ddev.site
DB driver : mysql
DB hostname : db
DB port : 3306
DB username : db
DB name : db
Database : Connected
Drupal bootstrap : Successful
Default theme : bartik
Admin theme : seven
PHP binary : /usr/bin/php7.3
PHP config : /etc/php/7.3/cli/php.ini
PHP OS : Linux
Drush script : /usr/local/bin/drush
Drush version : 10.2.2
Drush temp : /tmp
Drush configs : /var/www/html/vendor/drush/drush/drush.yml
/var/www/html/drush/drush.yml
Install profile : standard
Drupal root : /var/www/html/web
Site path : sites/default
Files, Public : sites/default/files
Files, Temp : /tmp

On the bad one only, after turning on xdebug in ddev, the PHP config line in drush status changes to:
PHP config : /tmp/bApEy0

I'm pretty sure my debugging problem has to do with the drush script line in drush status, but I can't find anything to change that affects that line.

Any ideas to point me in the right direction?

1

1 Answers

2
votes

I note that the first one shows "Drush script : /var/www/html/vendor/drush/drush/drush" and the second one "Drush script : /usr/local/bin/drush". But inside the container, /usr/local/bin/drush is "drush launcher". So there's definitely a difference in how this is happening.

  • When debugging drush (or any command line script), execute it the simplest way possible, which is inside the container, so ddev ssh and then run drush.
  • But be specific about what you're running, don't use the drush launcher in the container, run the site-installed drush by running /var/www/html/vendor/bin/drush - that way there aren't extra layers of scripts running extra layers of drush.
  • Nothing about drush or drush launcher on your host system would be relevant, because everything is happening inside the container.
  • Remember to ddev xdebug on before debugging.
  • Please review "PHPStorm and Command-Line Debugging" in the docs at https://ddev.readthedocs.io/en/latest/users/step-debugging/#step-debugging-with-ddev-and-xdebug and also Matt Glaman's excellent blog about xdebug over the command line