function conf_path

cis7 conf_path($require_settings = TRUE, $reset = FALSE)
cle7 conf_path($require_settings = TRUE, $reset = FALSE)
elmsmedia7 conf_path($require_settings = TRUE, $reset = FALSE)
icor7 conf_path($require_settings = TRUE, $reset = FALSE)
meedjum_blog7 conf_path($require_settings = TRUE, $reset = FALSE)
mooc7 conf_path($require_settings = TRUE, $reset = FALSE)

Returns the appropriate configuration directory.

Returns the configuration path based on the site's hostname, port, and pathname. Uses find_conf_path() to find the current configuration directory. See default.settings.php for examples on how the URL is converted to a directory.


bool $require_settings: Only configuration directories with an existing settings.php file will be recognized. Defaults to TRUE. During initial installation, this is set to FALSE so that Drupal can detect a matching directory, then create a new settings.php file in it.

bool $reset: Force a full search for matching directories even if one had been found previously. Defaults to FALSE.

Return value

The path of the matching directory.

See also


36 calls to conf_path()
at_core_filemanagement_form in sites/all/themes/ulmus/adaptivetheme/at_core/inc/forms/
@file Generate form elments for the File Management settings.
cis_helper_quick_setup_page in profiles/cis/modules/custom/cis_helper/
Callback for quick setup page to build a lot of elements at once.
cis_helper_quick_setup_page_submit in profiles/cis/modules/custom/cis_helper/
Implements hook_submit().
DatabaseTasks_sqlite::getFormOptions in includes/database/sqlite/
Return driver specific configuration options.
DrupalPublicStreamWrapper::getDirectoryPath in includes/
Implements abstract public function getDirectoryPath()

... See full list

3 string references to 'conf_path'
drupal_rewrite_settings in includes/
Replaces values in settings.php with values in the submitted array.
install_settings_form in includes/
Form constructor for a form to configure and rewrite settings.php.
install_verify_settings in includes/
Verifies the existing settings in settings.php.


includes/, line 541
Functions that need to be loaded on every Drupal request.


function conf_path($require_settings = TRUE, $reset = FALSE) {
  $conf = &drupal_static(__FUNCTION__, '');

  if ($conf && !$reset) {
    return $conf;

  $confdir = 'sites';

  $sites = array();
  if (file_exists(DRUPAL_ROOT . '/' . $confdir . '/sites.php')) {
    // This will overwrite $sites with the desired mappings.
    include (DRUPAL_ROOT . '/' . $confdir . '/sites.php');

  $server = explode('.', implode('.', array_reverse(explode(':', rtrim($_SERVER['HTTP_HOST'], '.')))));
  for ($i = count($uri) - 1; $i > 0; $i--) {
    for ($j = count($server); $j > 0; $j--) {
      $dir = implode('.', array_slice($server, -$j)) . implode('.', array_slice($uri, 0, $i));
      if (isset($sites[$dir]) && file_exists(DRUPAL_ROOT . '/' . $confdir . '/' . $sites[$dir])) {
        $dir = $sites[$dir];
      if (file_exists(DRUPAL_ROOT . '/' . $confdir . '/' . $dir . '/settings.php') || (!$require_settings && file_exists(DRUPAL_ROOT . '/' . $confdir . '/' . $dir))) {
        $conf = "$confdir/$dir";
        return $conf;
  $conf = "$confdir/default";
  return $conf;



Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/ in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/
The website encountered an unexpected error. Please try again later.