settings.php

  1. drupal
    1. 4.6 sites/default/settings.php
    2. 4.7 sites/default/settings.php
    3. 5 sites/default/settings.php

Drupal site-specific configuration file.

The configuration file to be loaded is based upon the rules below.

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.

For example, for a fictitious site installed at http://www.drupal.org/mysite/test/, the 'settings.php' 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

If you are installing on a non-standard port number, prefix the hostname with that number. For example, http://www.drupal.org:8080/mysite/test/ could be loaded from sites/8080.www.drupal.org.mysite.test/.

File

sites/default/settings.php
View source
  1. <?php
  2. /**
  3. * @file
  4. * Drupal site-specific configuration file.
  5. *
  6. * The configuration file to be loaded is based upon the rules below.
  7. *
  8. * The configuration directory will be discovered by stripping the
  9. * website's hostname from left to right and pathname from right to
  10. * left. The first configuration file found will be used and any
  11. * others will be ignored. If no other configuration file is found
  12. * then the default configuration file at 'sites/default' will be used.
  13. *
  14. * For example, for a fictitious site installed at
  15. * http://www.drupal.org/mysite/test/, the 'settings.php'
  16. * is searched in the following directories:
  17. *
  18. * 1. sites/www.drupal.org.mysite.test
  19. * 2. sites/drupal.org.mysite.test
  20. * 3. sites/org.mysite.test
  21. *
  22. * 4. sites/www.drupal.org.mysite
  23. * 5. sites/drupal.org.mysite
  24. * 6. sites/org.mysite
  25. *
  26. * 7. sites/www.drupal.org
  27. * 8. sites/drupal.org
  28. * 9. sites/org
  29. *
  30. * 10. sites/default
  31. *
  32. * If you are installing on a non-standard port number, prefix the
  33. * hostname with that number. For example,
  34. * http://www.drupal.org:8080/mysite/test/ could be loaded from
  35. * sites/8080.www.drupal.org.mysite.test/.
  36. */
  37. /**
  38. * Database settings:
  39. *
  40. * Note that the $db_url variable gets parsed using PHP's built-in
  41. * URL parser (i.e. using the "parse_url()" function) so make sure
  42. * not to confuse the parser. If your username, password
  43. * or database name contain characters used to delineate
  44. * $db_url parts, you can escape them via URI hex encodings:
  45. *
  46. * : = %3a / = %2f @ = %40
  47. * + = %2b ( = %28 ) = %29
  48. * ? = %3f = = %3d & = %26
  49. *
  50. * To specify multiple connections to be used in your site (i.e. for
  51. * complex custom modules) you can also specify an associative array
  52. * of $db_url variables with the 'default' element used until otherwise
  53. * requested.
  54. *
  55. * You can optionally set prefixes for some or all database table names
  56. * by using the $db_prefix setting. If a prefix is specified, the table
  57. * name will be prepended with its value. Be sure to use valid database
  58. * characters only, usually alphanumeric and underscore. If no prefixes
  59. * are desired, leave it as an empty string ''.
  60. *
  61. * To have all database names prefixed, set $db_prefix as a string:
  62. *
  63. * $db_prefix = 'main_';
  64. *
  65. * To provide prefixes for specific tables, set $db_prefix as an array.
  66. * The array's keys are the table names and the values are the prefixes.
  67. * The 'default' element holds the prefix for any tables not specified
  68. * elsewhere in the array. Example:
  69. *
  70. * $db_prefix = array(
  71. * 'default' => 'main_',
  72. * 'users' => 'shared_',
  73. * 'sessions' => 'shared_',
  74. * 'role' => 'shared_',
  75. * 'authmap' => 'shared_',
  76. * 'sequences' => 'shared_',
  77. * );
  78. *
  79. * Database URL format:
  80. * $db_url = 'mysql://username:password@localhost/databasename';
  81. * $db_url = 'mysqli://username:password@localhost/databasename';
  82. * $db_url = 'pgsql://username:password@localhost/databasename';
  83. */
  84. $db_url = 'mysql://username:password@localhost/databasename';
  85. $db_prefix = '';
  86. /**
  87. * Base URL (optional).
  88. *
  89. * If you are experiencing issues with different site domains,
  90. * uncomment the Base URL statement below (remove the leading hash sign)
  91. * and fill in the URL to your Drupal installation.
  92. *
  93. * You might also want to force users to use a given domain.
  94. * See the .htaccess file for more information.
  95. *
  96. * Examples:
  97. * $base_url = 'http://www.example.com';
  98. * $base_url = 'http://www.example.com:8888';
  99. * $base_url = 'http://www.example.com/drupal';
  100. * $base_url = 'https://www.example.com:8888/drupal';
  101. *
  102. * It is not allowed to have a trailing slash; Drupal will add it
  103. * for you.
  104. */
  105. # $base_url = 'http://www.example.com'; // NO trailing slash!
  106. /**
  107. * PHP settings:
  108. *
  109. * To see what PHP settings are possible, including whether they can
  110. * be set at runtime (ie., when ini_set() occurs), read the PHP
  111. * documentation at http://www.php.net/manual/en/ini.php#ini.list
  112. * and take a look at the .htaccess file to see which non-runtime
  113. * settings are used there. Settings defined here should not be
  114. * duplicated there so as to avoid conflict issues.
  115. */
  116. ini_set('arg_separator.output', '&amp;');
  117. ini_set('magic_quotes_runtime', 0);
  118. ini_set('magic_quotes_sybase', 0);
  119. ini_set('session.cache_expire', 200000);
  120. ini_set('session.cache_limiter', 'none');
  121. ini_set('session.cookie_lifetime', 2000000);
  122. ini_set('session.gc_maxlifetime', 200000);
  123. ini_set('session.save_handler', 'user');
  124. ini_set('session.use_only_cookies', 1);
  125. ini_set('session.use_trans_sid', 0);
  126. ini_set('url_rewriter.tags', '');
  127. /**
  128. * We try to set the correct cookie domain.
  129. */
  130. if (isset($_SERVER['HTTP_HOST'])) {
  131. $domain = '.'. preg_replace('`^www.`', '', $_SERVER['HTTP_HOST']);
  132. // Per RFC 2109, cookie domains must contain at least one dot other than the
  133. // first. For hosts such as 'localhost', we don't set a cookie domain.
  134. if (count(explode('.', $domain)) > 2) {
  135. // We need to use escaping because $_SERVER['HTTP_HOST'] can be modified
  136. // by a visitor.
  137. ini_set('session.cookie_domain', check_plain($domain));
  138. }
  139. }
  140. /**
  141. * On some sites, multiple domains or subdomains may point to the same site.
  142. * For instance, example.com may redirect to foo.example.com. In that case,
  143. * the browser may confuse the cookies between the two domains, resulting in
  144. * an inability to log in. In that case, uncomment the line below and set
  145. * it to the more generic domain name. For instance, .example.com is more
  146. * generic than .foo.example.com. Remember the leading period on the domain
  147. * name, even if you wouldn't type it in your browser.
  148. */
  149. #ini_set('session.cookie_domain', '.example.com');
  150. /**
  151. * Variable overrides:
  152. *
  153. * To override specific entries in the 'variable' table for this site,
  154. * set them here. You usually don't need to use this feature. This is
  155. * useful in a configuration file for a vhost or directory, rather than
  156. * the default settings.php. Any configuration setting from the 'variable'
  157. * table can be given a new value.
  158. *
  159. * Remove the leading hash signs to enable.
  160. */
  161. # $conf = array(
  162. # 'site_name' => 'My Drupal site',
  163. # 'theme_default' => 'pushbutton',
  164. # 'anonymous' => 'Visitor'
  165. # );
Login or register to post comments