0

I have a unique problem, for which I am unable to find the reason and thus not an inch closer to solution since 4 days.

Drush is taking a separate settings.php file instead of the correct one.

Check only the settings files link found on the link marked [2] in both the settings.

So in dev environment, drush takes the following config:

[vagrant@frontier www]$ php ../bin/drush.php core-config
Enter a number to choose which file to edit.
 [0]  :  Cancel
         -- PHP ini files --
 [1]  :  /etc/php.ini
         -- Drupal --
 [2]  :  /var/www/sites/$DRUPAL_ROOT/cnf/settings.php
 [3]  :  /var/www/sites/$DRUPAL_ROOT/www/.htaccess

But on the deployment server, drush takes up the following config:

/var/www/frontier/www
devtools(pabetadfsp01p):php ../bin/drush.php core-config
Enter a number to choose which file to edit.
 [0]  :  Cancel
         -- PHP ini files --
 [1]  :  /etc/php.ini
         -- Drupal --
 [2]  :  /var/www/$DRUPAL_ROOT/www/sites/www/settings.php
 [3]  :  /var/www/$DRUPAL_ROOT/www/.htaccess

Now, I create a symlink at $DRUPAL_ROOT/www/sites/default/settings.php which refers to $DRUPAL_ROOT/cnf/settings.php. So drupal picks up the correct settings while drush doesn't.

I really don't have any idea as to what could cause this mis-configuration. Please let me know any remedy.

Also I don't create a www folder in the sites folder at $DRUPAL_ROOT/www/sites/ which is displayed on drush settings on deployment server.

1

First off, you should not call drush.php directly; use the drush script instead.

Regarding site selection, Drupal looks up the site to use based on the domain name in the http request, which is passed in via the HTTP headers. When you are using Drush, there is no web browser involved, so Drush needs to generate equivalent HTTP headers and select the appropriate site based on information that is provided either explicitly (via commandline options) or implicitly (via the current working directory).

If your cwd is inside your Drupal root, then Drush will, by default, look for the settings.php file inside the 'default' folder. You can change this default by setting your cwd to the folder that contains the settings.php file that you want, or by passing in --uri=mydrupalsite.com as a commandline option (or -l mydrupalsite.com). You might also want to read up on Drupal site aliases, which are an even more convenient way to tell Drush which Drupal site you'd like to use with your command.

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.