ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Site Error: Unable to Load Site Preferences; Invalid Preference Data

June 17, 2011 6:53pm

Subscribe [3]
  • #1 / Jun 17, 2011 6:53pm

    Deelicious

    86 posts

    After upgrading my website to version v2.1.3, build 20110411 I am able to successfully view and edit my first website. I then upgraded my MSM to v2 so I could edit my second site and am now getting the following error when I view my second site:

    Site Error: Unable to Load Site Preferences; Invalid Preference Data

    I’ve read previous posts on this issue, but my head is spinning so I was hoping to get some help on the first step to solving this problem. Thanks.

    -Deanna

  • #2 / Jun 20, 2011 8:05am

    Sue Crocker

    26054 posts

    Hi, Deanna.

    Can you post what is in your index.php file for the second site? Are you using an admin.php to mask access to the control panel, or just getting to the second site from the first one?

  • #3 / Jun 20, 2011 1:56pm

    Deelicious

    86 posts

    Sure Sue,

    Here is the index.php for the second website:

    <?php
    /*
    =====================================================
     ExpressionEngine - by EllisLab
    -----------------------------------------------------
     <a href="http://expressionengine.com/">http://expressionengine.com/</a>
    -----------------------------------------------------
     Copyright (c) 2003 - 2007 EllisLab, Inc.
    =====================================================
     THIS IS COPYRIGHTED SOFTWARE
     PLEASE READ THE LICENSE AGREEMENT
     <a href="http://expressionengine.com/docs/license.html">http://expressionengine.com/docs/license.html</a>
    =====================================================
     File: index.php
    -----------------------------------------------------
     Purpose: Triggers the main engine
    =====================================================
    */
    
    // URI Type
    // This variable allows you to hard-code the URI type.
    // For most servers, 0 works fine.
    // 0 = auto  
    // 1 = path_info  
    // 2 = query_string
    
    $qtype = 0; 
    
    
    // DO NOT EDIT BELOW THIS!!! 
    
    error_reporting(0);
    
    if (isset($_GET['URL'])) 
    { 
        /** ---------------------------------
        /**  URL Redirect for CP and Links in Comments
        /** ---------------------------------*/
    
        $_GET['URL'] = str_replace(array("\r", "\r\n", "\n", ':',':','/','/'), 
                                   array('', '', '', ':', ':', '/', '/'), 
                                   $_GET['URL']);
        
        if (substr($_GET['URL'], 0, 4) != "http" AND ! ereg('://', $_GET['URL'])) 
            $_GET['URL'] = "http://".$_GET['URL']; 
            
        $_GET['URL'] = str_replace( array('"', "'", ')', '(', ';', '}', '{', 'script%', 'script&', '(', ')'), 
                                    '', 
                                    strip_tags($_GET['URL']));
        
        $host = ( ! isset($_SERVER['HTTP_HOST'])) ? '' : (substr($_SERVER['HTTP_HOST'],0,4) == 'www.' ? substr($_SERVER['HTTP_HOST'], 4) : $_SERVER['HTTP_HOST']);
        
        if ( ! isset($_SERVER['HTTP_REFERER']) OR ! stristr($_SERVER['HTTP_REFERER'], $host))
        {
            // Possibly not from our site, so we give the user the option
            // Of clicking the link or not
            
            $str = "<html>\n<head>\n<title>Redirect</title>\n</head>\n<body>".
                    "To proceed to the URL you have requested, click the link below:".
                    "<a href="http://.$_GET">".$_GET['URL']."</a>\n</body>\n</html>";
        }
        else
        {
            $str = "<html>\n<head>\n<title>Redirect</title>\n".
                   '<meta http-equiv="refresh" content="0; URL='.$_GET['URL'].'">'.
                   "\n</head>\n<body>\n</body>\n</html>";
        }
        
        exit($str);
    }
    
    $uri  = '';
    $pathinfo = pathinfo(__FILE__);
    $ext  = ( ! isset($pathinfo['extension'])) ? '.php' : '.'.$pathinfo['extension'];
    $self = ( ! isset($pathinfo['basename'])) ? 'index'.$ext : $pathinfo['basename'];
    
    $path_info = (isset($_SERVER['PATH_INFO'])) ? $_SERVER['PATH_INFO'] : @getenv('PATH_INFO');
    $query_str = (isset($_SERVER['QUERY_STRING'])) ? $_SERVER['QUERY_STRING'] : @getenv('QUERY_STRING');
    
    switch ($qtype)
    {
        case 0 :    $uri = ($path_info != '' AND $path_info != "/".$self) ? $path_info : $query_str;
            break;
        case 1 :    $uri = $path_info;     
            break;
        case 2 :    $uri = $query_str; 
            break;
    }
    
    unset($system_path);
    unset($config_file);
    unset($path_info);
    unset($query_str);
    unset($qstr);
    
    require 'path'.$ext;
    
    if ((isset($template_group) AND isset($template)) && $uri != '' && $uri != '/')
    {
        $template_group = '';
        $template = '';
    }
    
    if ( ! isset($system_path))
    {
        if (file_exists('install'.$ext))
        {
            header("location: install".$ext); 
            exit;
        }
        else
        {
            exit("The system does not appear to be installed. Click <a href="http://install.php">here</a> to install it.");    
        }
    }
    
    if ( ! ereg("/$", $system_path)) $system_path .= '/';
    
    if ( ! @include($system_path.'core/core.system'.$ext))
    {
        exit("The system path does not appear to be set correctly.  Please open your path.php file and correct the path.");    
    }
    
    ?>

    I am not using an admin.php mask. The admin for the second site is under the first site’s domain and control panel.

  • #4 / Jun 20, 2011 5:20pm

    Brandon Jones

    5500 posts

    Hi Deelicious,

    That’s an EE 1.x index.php file. You’ll need to duplicate the EE 2.x index.php (from your first site), make the appropriate changes, and use that for your second site instead. Does that help?

  • #5 / Jun 20, 2011 5:44pm

    Deelicious

    86 posts

    Yes, that did the trick. Thanks so much, this saved me a lot of time!

  • #6 / Jun 20, 2011 5:48pm

    Brandon Jones

    5500 posts

    Glad that worked, it’s easy to forget and we’ve clarified this in the documentation that will be launching with EE 2.2 later this week. Don’t hesitate to post again if anything else comes up!

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases