1

We are trying to change the database settings for a long-standing drupal 6 site, but are having trouble finding the correct settings.php file:

$ cd /var/www/vhosts/mysite
$ find sites/ -name "settings.php*"
sites/default/settings.php.save
sites/default/settings.php.mod2
sites/mobile.mysite.com/settings.php
sites/mysite.com/settings.php
sites/mysite.com/settings.php.pre_handoff_unedited
sites/mysite.com/settings.php~
sites/mysite.com/settings.php.20131022

We renamed the two most likely suspects, but the sites continues to run smoothly:

sites/mobile.mysite.com/settings.php_hold
sites/mysite.com/settings.php_hold

I also looked for a sites.php that might be overriding settings.php, but we don't seem to have one of those either:

$ find sites/ -name "*sites.php*"
$

Which means I can't find a sites.php or settings.php anywhere in the web directory that seems to control drupal.

We have nginx set up to receive http requests and mysite.com requests are forwarded to apache. Could that be relevant? Where else I might look for the drupal config settings?

1
  • Based on what you posted, settings.php should be in /sites/mysite.com/settings.php. Did you try clearing caches after editing that file? Mar 10, 2016 at 22:23

2 Answers 2

1

You should search for setting file as:

find sites/ -name settings.php

as the file won't have any other name than settings.php (unless included from settings.php).

So you're down with these 2 valid entries:

sites/mobile.mysite.com/settings.php
sites/mysite.com/settings.php

Normally when you have settings.php in sites/default it applies to all sites, unless overridden by the site specific file (which is the case).

So:

  • sites/mobile.mysite.com will work on sites like mobile.mysite.com
  • sites/mysite.com/settings.php works on sites like mysite.com

Here is example from default.settings.php documentation page:

For example, for a fictitious site installed at http://www.drupal.org/mysite/test/, the settings.php file is searched in the following directories:

  1. sites/www.drupal.org.mysite.test
  2. sites/drupal.org.mysite.test
  3. sites/org.mysite.test
  4. sites/www.drupal.org.mysite
  5. sites/drupal.org.mysite
  6. sites/org.mysite
  7. sites/www.drupal.org
  8. sites/drupal.org
  9. sites/org
  10. sites/default

The configuration directory will be discovered by stripping the website's hostname from left to right and pathname from right to left. The first configuration file found will be used and any others will be ignored. If no other configuration file is found then the default configuration file at sites/default will be used.


If you're still confused, please run drush status command to find the right settings file, e.g.

$ drush status | grep settings
 Drupal Settings File            :  sites/default/settings.php

or for specific site:

$ drush -l http://mobile.mysite.com status | grep settings

0

Domain Wise settings.php file

1) sites/mobile.mysite.com/settings.php --> This is the original file for

2) mobile.mysite.com domain

3) sites/mysite.com/settings.php --> This is the original file for mysite.com Domain

4) sites/mysite.com/settings.php~ --> This file is last edited and it has the recent changes. But due to unexpected closing of editing application(like vi or emac editor) the file changes are saved in this file

Also you can use below commands to check the last file modification time for all above three files.

e.g.

file sites/mobile.mysite.com/settings.php
stat sites/mobile.mysite.com/settings.php

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.