2

Previously with drush 7, I could cd to the site directory (e.g. sites/example1.com) and perform drush commands (e.g. drush st). Now with drush 8, unless I specify the root in the drush command, it cannot bootstrap past level 0:

$ drush st
 PHP configuration      :  C:\wamp64\bin\php\php7.1.9\php.ini
 PHP OS                 :  WINNT
 Drush script           :  C:/Users/Dan/AppData/Roaming/Composer/vendor/drush/drush/drush.php
 Drush version          :  8.1.18
 Drush temp directory   :  C:\Users\Dan\AppData\Local\Temp
 Drush configuration    :
 Drush alias files      :


$ drush st -r c:/wamp64/www/drupal7
           Drupal version                  :  7.64
 Site URI                        :  http://example.com
 Database driver                 :  mysql
 Database hostname               :  localhost
 ....

I do have a sites/sites.php file:

 <?php 
 $sites = [
    'dev.example1.com' => 'example1.com',
    'dev.example2.com' => 'example2.com',
    'dev.example3.us' => 'example3.us',
 ];

Local site sites\example1\drushrc.php file:

<?php
$options['l'] = "http://dev.example1.com";
$options['r'] = 'c:/wamp64/www/drupal7';

Without the -r root option, drush doesn't load the sites.php or the drushrc.php.

Drush is installed globally using composer. It was not installed as part of drupal 8.

MORE INFO: Oddly, drush 8 is working with drupal 8 in a multisite directory.

1 Answer 1

2

It appears that drush 8 does not support drupal projects that were not built with composer. Drush 7 does not have this requirement. I added this composer.json to the drupal 7 root directory:

{
  "require": { 
    "drush/drush": "~8.0"
  }, 
  "extra": {
    "installer-paths": {
       ".": [ "type:drupal-core" ]
    } 
  } 
}

I found this in an issue for project drupal-finder, which seems to be used by the Drupal 9 Drupal Launcher. I'm guessing that drush 8 has similar code.

Your Answer

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

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