1

We have a multisite set up with Drupal 8.6.1 and Drush 9.4.0. This is set up on two servers that were set up identically.

The issue we are running into is that Drush is only detecting defaultsite, no matter what directory we are in.

This is creating two issues:

On server #1 - defaultsite no longer exists. Drush is still trying to use it's URI and DB variables, so is throwing an "unable to bootstrap the Drupal database" error, and we cannot run any database-related commands.

On server #2 - defaultsite exists, so it is able to run commands. But, when we try to enable a module, it enables the module on defaultsite no matter what site's folder we are in.

Here is what drush status outputs (whe inside of the directory: gtest.ng.evenvision.com):

 Drupal version   : 8.6.1
 Site URI         : default
 DB driver        : mysql
 DB hostname      : localhost
 DB port          : 3306
 DB username      : defaultuser
 DB name          : defaultsite
 Database         : Connected
 Drupal bootstrap : Successful
 Default theme    : ev_base_child
 Admin theme      : ev_seven
 PHP binary       : /usr/bin/php
 PHP config       : /etc/php.ini
 PHP OS           : Linux
 Drush script     : /usr/bin/drush
 Drush version    : 9.4.0
 Drush temp       : /tmp
 Drush configs    : /var/www/nginx/vendor/drush/drush/drush.yml
                    /var/www/nginx/drush/drush.yml
 Install profile  : minimal
 Drupal root      : (removed)
 Site path        : sites/default
 Files, Public    : public
 Files, Private   : private
 Files, Temp      : /tmp

And, this is what settings.php for gtest.ng.evenvision.com contains:

$databases['default']['default'] = array (
  'database' => 'gtest2018',
  'username' => 'gtest2018',
  'password' => '54352432346greg433',
  'prefix' => '',
  'host' => 'localhost',
  'port' => '3306',
  'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
  'driver' => 'mysql',
);
1

I don’t know how your setup is now but you need to have something like this.

 sites/site-name-1/settings.php

Containing

$databases['default']['default'] = array (
  'database' => 'gtest2018',
  'username' => 'gtest2018',
  'password' => '54352432346greg433',
  'prefix' => '',
  'host' => 'localhost',
  'port' => '3306',
  'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
  'driver' => 'mysql',
);

And then the same for the other instances.

Then when you want to install a module in one instance run drush en MODULE_NAME -l site-name-1.

For more info look here: Multisite folder structure in Drupal 8.

Your Answer

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

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