0

Drush won't run at the command line in any Drupal 8 subdomain installation: [warning] Drush command terminated abnormally.

I am using GreenGeeks hosting for several Drupal 8.8.7 sites, one 8.8.6 site, one 9.0.0 site as subdomains, e.g. subdomain.domain.com and each subdomain is configured to point to the /web subdirectory (by installation default).

  • I installed Drush using this guide: https://www.greengeeks.com/support/article/how-do-i-install-drush/
  • I used composer successfully to install all above sites, by following the same guide and supplementing with version specific installation instructions, e.g. composer create-project drupal/recommended-project:8.8.7 bingo
  • I updated my .bashrc file, by using the same guide, i.e.
# User specific aliases and functions
alias drush='~/drush/vendor/bin/drush'

The D8 websites work fine. HOWEVER, if I navigate to the command line of any of the 8.x drupal sites, then Drush will not run as example below:

acctname@svrname [~/public_html/bingo]# drush version
 [warning] Drush command terminated abnormally.
acctname@svrname [~/public_html/bingo]#

Drush runs NORMALLY at the /public_html directory, but there is no drupal installed there:

acctname@svrname [~/public_html]# drush version
 Drush version : 10.2.2
acctname@svrname [~/public_html]#

Drush ALSO RUNS NORMALLY at the Drupal9 website:

acctname@svrname [~/public_html/drupal9]# drush version
 Drush version : 10.2.2
acctname@svrname [~/public_html/drupal9]#

THE FOLLOWING INFO MAY NOT BE RELATED... HOWEVER, at the risk of distraction, the errorlog indicates a drush-related error for the D9 website and the website suddenly shows this error (it used to work): The website encountered an unexpected error. Please try again later.

And the error_log reports this: Error: Class 'Drush\Log\DrushLog' not found in /home/projects/public_html/drupal9/web/core/lib/Drupal/Component/DependencyInjection/Container.php on line 257

...but Drush still runs normally

  • 1
    So you have Composer-managed projects? Then you cd yourproject and add Drush to a project locally composer require drush/drush. Then you call it directly from inside the project vendor/drush/drush/drush cr. Optionally install the global Drush Launcher to be able to simply run drush cr. – leymannx Jun 20 at 5:45
  • As lenymannx said, with composer managed projects, drush should be a managed by composer just like all your other contrib modules, libraries, etc. I'd recommend uninstalling drush globally (undo the steps you followed in the 7 year old guide), then remove the alias in your .bashrc, then follow the steps leymannx laid out. – sonfd Jun 20 at 12:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.