CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Could not load the settings file
Pages: [1] 2

Author Topic: Could not load the settings file  (Read 2708 times)

johnnybgoodwin

  • I’m new here
  • *
  • Posts: 22
  • Karma: 0
  • CiviCRM version: 4.1.2
  • CMS version: Joomla 2.5.5
  • MySQL version: 5.5
  • PHP version: 5.2.17
Could not load the settings file
March 18, 2014, 08:19:23 pm
When I try to upload an image to the server or browse images I get the error message:
"Could not load the settings file at: /home/[mydomain]/public_html/administrator/components/com_civicrm/civicrm/../..//default/civicrm.settings.php"

I have checked that system url paths are correct.

Appreciate any suggestions.

John

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Could not load the settings file
March 20, 2014, 07:45:09 am
Was this database migrated from Drupal perhaps? The /default/ part is not standard for Joomla...
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

johnnybgoodwin

  • I’m new here
  • *
  • Posts: 22
  • Karma: 0
  • CiviCRM version: 4.1.2
  • CMS version: Joomla 2.5.5
  • MySQL version: 5.5
  • PHP version: 5.2.17
Re: Could not load the settings file
May 13, 2014, 11:25:12 am
Sorry - I didn't see that there was a reply - I guess I don't automatically follow my own posts!
I've never used Drupal. It was only ever upgraded from an earlier version of Joomla! 1.5 to 2.5x (latest version). I don't know how that part of the path got set. Do you know what the right path should be and where I can set the correct path? (I'm  back here today 'cos I'm having the same problem....!)

Thaks again.

John
« Last Edit: May 13, 2014, 11:32:47 am by johnnybgoodwin »

Jeremy Proffitt

  • I post occasionally
  • **
  • Posts: 63
  • Karma: 2
    • Mobius New Media
  • CiviCRM version: 4.4.x
  • CMS version: Joomla 2.5.x/3.x / D7
  • MySQL version: 5.1.x
  • PHP version: 5.3.10+, 5.4.x
Re: Could not load the settings file
May 13, 2014, 11:27:30 am
You'll want to check in administrator/components/com_civicrm/civicrm/civicrm.config.php.
Jeremy Proffitt
Mobius New Media
IRC: JP_EzoD

johnnybgoodwin

  • I’m new here
  • *
  • Posts: 22
  • Karma: 0
  • CiviCRM version: 4.1.2
  • CMS version: Joomla 2.5.5
  • MySQL version: 5.5
  • PHP version: 5.2.17
Re: Could not load the settings file
May 13, 2014, 11:33:13 am
Okay I'll look - thanks!

johnnybgoodwin

  • I’m new here
  • *
  • Posts: 22
  • Karma: 0
  • CiviCRM version: 4.1.2
  • CMS version: Joomla 2.5.5
  • MySQL version: 5.5
  • PHP version: 5.2.17
Re: Could not load the settings file
May 14, 2014, 04:58:01 am
com_civicrm/civicrm/civicrm.config.php seems to be all about Drupal, but this is a Joomla! site. Is there somewhere I can go to just change the path of the settings file? I haven't changed anything from the default settings when installing.
Thanks

Jeremy Proffitt

  • I post occasionally
  • **
  • Posts: 63
  • Karma: 2
    • Mobius New Media
  • CiviCRM version: 4.4.x
  • CMS version: Joomla 2.5.x/3.x / D7
  • MySQL version: 5.1.x
  • PHP version: 5.3.10+, 5.4.x
Re: Could not load the settings file
May 14, 2014, 05:03:22 am
civicrm.config.php isn't actually all about Drupal, and the Bootstrapping function that Civi uses to load Joomla core looks to that file in order to decide where the settings file is. You'll also need to make sure you flushed the cache in templates_c and removed the content of media/civicrm/ConfigAndLog, as that can influence the loading as well.
Jeremy Proffitt
Mobius New Media
IRC: JP_EzoD

johnnybgoodwin

  • I’m new here
  • *
  • Posts: 22
  • Karma: 0
  • CiviCRM version: 4.1.2
  • CMS version: Joomla 2.5.5
  • MySQL version: 5.5
  • PHP version: 5.2.17
Re: Could not load the settings file
May 14, 2014, 08:01:09 am
Jeremy thanks for your reply. I'm not a programmer, and know little about .php, but I checked out that file again. I can see a lot of commented out lines about what the path should be for $confdir, but no actual specific path.
There is the bit about specifying the $confdir path by reducing the path in steps, the bit starting with starting with
" *  1.  confdir/www.drupal.org.mysite.test"

Then there seems to be a lot of code that attempts to figure out the path.

Should this file have an actual line that says (something like) "$confdir/www.mysite.ca/"  ?

This is the point where I start to think, "I did good.... I got CIVI installed. It should work, but its way too complicated...." etc.

Appreciate your help.
« Last Edit: May 14, 2014, 08:13:35 am by johnnybgoodwin »

Jeremy Proffitt

  • I post occasionally
  • **
  • Posts: 63
  • Karma: 2
    • Mobius New Media
  • CiviCRM version: 4.4.x
  • CMS version: Joomla 2.5.x/3.x / D7
  • MySQL version: 5.1.x
  • PHP version: 5.3.10+, 5.4.x
Re: Could not load the settings file
May 14, 2014, 08:13:24 am
Now I see what's going on... you're not seeing the right file at all. The file that your looking at should be in your Joomla install at administrator/components/com_civicrm/civicrm/civicrm.config.php.

The file should look like the following (I've replaced my personal data with [your path here]):

Code: [Select]
<?php
define
('CIVICRM_SETTINGS_PATH', '[your_path_here]/administrator/components/com_civicrm/civicrm.settings.php');
$error = @include_once( '[your_path_here]/administrator/components/com_civicrm/civicrm.settings.php' );
if ( 
$error == false ) {
    echo 
"Could not load the settings file at: [your_path_here]/administrator/components/com_civicrm/civicrm.settings.php
"
;
    exit( );
}

// Load class loader
require_once $civicrm_root . '/CRM/Core/ClassLoader.php';
CRM_Core_ClassLoader::singleton()->register();

The your path here is the path for your hosting environment which if you use cPanel is probably /home/yourusername/public_html/ or something similar.
Jeremy Proffitt
Mobius New Media
IRC: JP_EzoD

johnnybgoodwin

  • I’m new here
  • *
  • Posts: 22
  • Karma: 0
  • CiviCRM version: 4.1.2
  • CMS version: Joomla 2.5.5
  • MySQL version: 5.5
  • PHP version: 5.2.17
Re: Could not load the settings file
May 14, 2014, 08:20:12 am
Hi again. Thanks for such a speedy reply. That is in fact the file I've been looking at. Here is the complete contents of the file:

<?php

/**
 * This function has been copied from DRUPAL_ROOT/includes/bootstrap.inc
 */

/**
 * Locate the appropriate configuration file.
 *
 * Try finding a matching configuration directory by stripping the
 * website's hostname from left to right and pathname from right to
 * left.  The first configuration file found will be used, the
 * remaining will ignored.  If no configuration file is found,
 * return a default value '$confdir/default'.
 *
 * Example for a fictitious site installed at
 * http://www.drupal.org/mysite/test/ the 'settings.php' is
 * searched in the following directories:
 *
 *  1. $confdir/www.drupal.org.mysite.test
 *  2. $confdir/drupal.org.mysite.test
 *  3. $confdir/org.mysite.test
 *
 *  4. $confdir/www.drupal.org.mysite
 *  5. $confdir/drupal.org.mysite
 *  6. $confdir/org.mysite
 *
 *  7. $confdir/www.drupal.org
 *  8. $confdir/drupal.org
 *  9. $confdir/org
 *
 * 10. $confdir/default
 *
 */

function civicrm_conf_init() {
    global $skipConfigError;

    static $conf = '';

    if ($conf) {
        return $conf;
    }

    /**
     * We are within the civicrm module, the drupal root is 2 links
     * above us, so use that
     */
    $currentDir = dirname( __FILE__ ) . DIRECTORY_SEPARATOR;
    if ( file_exists( $currentDir . 'settings_location.php' ) ) {
        include $currentDir . 'settings_location.php';
    }

    if ( defined( 'CIVICRM_CONFDIR' ) && ! isset( $confdir ) ) {
        $confdir = CIVICRM_CONFDIR;
    } else {
        // make it relative to civicrm.config.php, else php makes it relative
        // to the script that invokes it
        $moduleDir  = 'sites' . DIRECTORY_SEPARATOR . 'all' . DIRECTORY_SEPARATOR . 'modules';
        $contribDir = $moduleDir . DIRECTORY_SEPARATOR . 'contrib';
        // check to see if this is under sites/all/modules/contrib
        if ( strpos( $currentDir, $contribDir ) !== false ) {
            $confdir = $currentDir . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..';
        // check to see if this is under sites/all/modules
        } else if ( strpos( $currentDir, $moduleDir ) !== false ) {
            $confdir = $currentDir . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..';
        } else if ( strpos( $currentDir, 'plugins' . DIRECTORY_SEPARATOR . 'civicrm' . DIRECTORY_SEPARATOR . 'civicrm' ) !== false ) {
             //if its wordpress
            $confdir = $currentDir . DIRECTORY_SEPARATOR . '..';
        } else {
            $confdir = $currentDir . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR;
        }
    }

    if ( file_exists( $confdir . DIRECTORY_SEPARATOR . 'civicrm.settings.php' ) ) {
        return $confdir;
    }

    if ( ! file_exists( $confdir ) && ! $skipConfigError ) {
        echo "Could not find valid configuration dir, best guess: $confdir<br/><br/>\n";
        exit( );
    }

    $phpSelf  = array_key_exists( 'PHP_SELF' , $_SERVER ) ? $_SERVER['PHP_SELF' ] : '';
    $httpHost = array_key_exists( 'HTTP_HOST', $_SERVER ) ? $_SERVER['HTTP_HOST'] : '';

    $uri    = explode('/', $phpSelf );
    $server = explode('.', implode('.', array_reverse(explode(':', rtrim($httpHost, '.')))));
    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 (file_exists("$confdir/$dir/civicrm.settings.php")) {
                $conf = "$confdir/$dir";
                return $conf;
            }
        }
    }

    // FIXME: problem spot for Drupal 5.1 config dir layout
    $conf = "$confdir/default";
    return $conf;
}

$settingsFile = civicrm_conf_init( ) . '/civicrm.settings.php';
define('CIVICRM_SETTINGS_PATH', $settingsFile);
$error = @include_once( $settingsFile );
if ( $error == false ) {
    echo "Could not load the settings file at: {$settingsFile}\n";
    exit( );
}

// Load class loader
global $civicrm_root;
require_once $civicrm_root . '/CRM/Core/ClassLoader.php';
CRM_Core_ClassLoader::singleton()->register();

I haven't moved anything, but this doesn't look like what you have pasted into your reply!

The path, again, to be sure, where I am opening this file is
/public_html/administrator/components/com_civicrm/civicrm/civicrm.config.php

Any more insight? What did I do!?


Jeremy Proffitt

  • I post occasionally
  • **
  • Posts: 63
  • Karma: 2
    • Mobius New Media
  • CiviCRM version: 4.4.x
  • CMS version: Joomla 2.5.x/3.x / D7
  • MySQL version: 5.1.x
  • PHP version: 5.3.10+, 5.4.x
Re: Could not load the settings file
May 14, 2014, 08:27:01 am
It looks like this is from an exceptionally old version of Civi, as there are Drupal 5 mentions in here. No version of Civi 4.x for Joomla has a file that looks like that.

Just copy your current file to a new file, and replace all the code in the original with the block that I included. Make sure you replace all the [your_path_here] placeholders with /home/yourdomain/public_html/.

That should get you on the right path (no pun intended).
Jeremy Proffitt
Mobius New Media
IRC: JP_EzoD

johnnybgoodwin

  • I’m new here
  • *
  • Posts: 22
  • Karma: 0
  • CiviCRM version: 4.1.2
  • CMS version: Joomla 2.5.5
  • MySQL version: 5.5
  • PHP version: 5.2.17
Re: Could not load the settings file
May 14, 2014, 12:00:13 pm
Me again. Not to belabour the point too much, but I just checked an unzipped version of CIVI 4.4.4 that I downloaded in February this year, and the contents of that file on my local computer are exactly as I posted earler and installed on the server, so I wonder if I really am looking in the wrong place?

Jeremy Proffitt

  • I post occasionally
  • **
  • Posts: 63
  • Karma: 2
    • Mobius New Media
  • CiviCRM version: 4.4.x
  • CMS version: Joomla 2.5.x/3.x / D7
  • MySQL version: 5.1.x
  • PHP version: 5.3.10+, 5.4.x
Re: Could not load the settings file
May 14, 2014, 12:40:37 pm
I actually grep'ed all the available versions of 4.4.4 on SourceForge. The problem is that the file you're looking at is from a Drupal install. That function name doesn't exist in civicrm-4.4.4-joomla.zip at all. You have somehow put the Drupal files into your Joomla installation, and that's why it isn't working. The function civicrm_conf_init only exists in the Drupal distribution.
Jeremy Proffitt
Mobius New Media
IRC: JP_EzoD

johnnybgoodwin

  • I’m new here
  • *
  • Posts: 22
  • Karma: 0
  • CiviCRM version: 4.1.2
  • CMS version: Joomla 2.5.5
  • MySQL version: 5.5
  • PHP version: 5.2.17
Re: Could not load the settings file
May 14, 2014, 01:54:46 pm
Expletive! How'd that happen????!!!
Okay, I will download the latest Joomla! version and see if I can run a new install.
Thanks for your help.

Edit: The downloaded v4.4.4 .zip file from Feb. was definitely labelled Joomla so maybe there was an error in naming on the download server?
« Last Edit: May 14, 2014, 02:01:56 pm by johnnybgoodwin »

Jeremy Proffitt

  • I post occasionally
  • **
  • Posts: 63
  • Karma: 2
    • Mobius New Media
  • CiviCRM version: 4.4.x
  • CMS version: Joomla 2.5.x/3.x / D7
  • MySQL version: 5.1.x
  • PHP version: 5.3.10+, 5.4.x
Re: Could not load the settings file
May 14, 2014, 02:37:55 pm
The "alt" file does in fact have a problem. I didn't get that one because I assumed they'd be the same. CRM-14691 has been filed to get that removed from the server.
« Last Edit: May 14, 2014, 02:42:50 pm by Jeremy Proffitt »
Jeremy Proffitt
Mobius New Media
IRC: JP_EzoD

Pages: [1] 2
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Could not load the settings file

This forum was archived on 2017-11-26.