We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 53438
    • 16 Posts
    I am trying to upgrade my site which is on 1.0.4 to 1.2.1. After upgrading, no error found and I can log in the backend using the manager. But it shows nothing on the front side when I visit on my browser http://127.0.1.1/evolution-1.2.1/

    This is my config file:

    
    <?php
    /**
     * MODX Configuration file
     */
    $database_type     = 'mysqli';
    $database_server   = 'localhost';
    $database_user     = 'root';
    $database_password = 'xxx';
    $database_connection_charset = 'latin1';
    $database_connection_method = 'SET CHARACTER SET';
    $dbase             = '`modx_mysite`';
    $table_prefix      = 'modx_';
    
    $lastInstallTime = 1494016583;
    
    $https_port = '443';
    
    if(!defined('MGR_DIR')) define('MGR_DIR', 'manager');
    
    // automatically assign base_path and base_url
    if(empty($base_path)||empty($base_url)||$_REQUEST['base_path']||$_REQUEST['base_url']) {
        $sapi= 'undefined';
        if (!strstr($_SERVER['PHP_SELF'], $_SERVER['SCRIPT_NAME']) && ($sapi= @ php_sapi_name()) == 'cgi') {
            $script_name= $_SERVER['PHP_SELF'];
        } else {
            $script_name= $_SERVER['SCRIPT_NAME'];
        }
        $script_name = str_replace('\\', '/', dirname($script_name));
        if(strpos($script_name,MGR_DIR)!==false)
            $separator = MGR_DIR;
        elseif(strpos($script_name,'/assets/')!==false)
            $separator = 'assets';
        else $separator = '';
    
        if($separator!=='') $a= explode('/'.$separator, $script_name);
        else $a = array($script_name);
    
        if (count($a) > 1)
            array_pop($a);
        $url= implode($separator, $a);
        reset($a);
        $a= explode(MGR_DIR, str_replace('\\', '/', dirname(__FILE__)));
        if (count($a) > 1)
            array_pop($a);
        $pth= implode(MGR_DIR, $a);
        unset ($a);
        $base_url= $url . (substr($url, -1) != '/' ? '/' : '');
        $base_path= $pth . (substr($pth, -1) != '/' && substr($pth, -1) != '\\' ? '/' : '');
    }
    
    // check for valid hostnames
    $site_hostname = str_replace(':' . $_SERVER['SERVER_PORT'], '', $_SERVER['HTTP_HOST']);
    if (!defined('MODX_SITE_HOSTNAMES')) {
    	$site_hostnames_path = $base_path . 'assets/cache/siteHostnames.php';
    	if (is_file($site_hostnames_path)) {
    		include_once($site_hostnames_path);
    	} else {
    		define('MODX_SITE_HOSTNAMES', '');
    	}
    }
    $site_hostnames = explode(',', MODX_SITE_HOSTNAMES);
    if (!empty($site_hostnames[0]) && !in_array($site_hostname, $site_hostnames)) {
        $site_hostname = $site_hostnames[0];
    }
    
    
    // assign site_url
    $site_url= ((isset ($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') || $_SERVER['SERVER_PORT'] == $https_port) ? 'https://' : 'http://';
    $site_url .= $site_hostname;
    if ($_SERVER['SERVER_PORT'] != 80)
        $site_url= str_replace(':' . $_SERVER['SERVER_PORT'], '', $site_url); // remove port from HTTP_HOST  
    $site_url .= ($_SERVER['SERVER_PORT'] == 80 || (isset ($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') || $_SERVER['SERVER_PORT'] == $https_port) ? '' : ':' . $_SERVER['SERVER_PORT'];
    $site_url .= $base_url;
    
    if (!defined('MODX_BASE_PATH')) define('MODX_BASE_PATH', $base_path);
    if (!defined('MODX_BASE_URL')) define('MODX_BASE_URL', $base_url);
    if (!defined('MODX_SITE_URL')) define('MODX_SITE_URL', $site_url);
    if (!defined('MODX_MANAGER_PATH')) define('MODX_MANAGER_PATH', $base_path.MGR_DIR.'/');
    if (!defined('MODX_MANAGER_URL')) define('MODX_MANAGER_URL', $site_url.MGR_DIR.'/');
    
    // start cms session
    if(!function_exists('startCMSSession')) {
        
        global $site_sessionname;
        $_ = crc32(__FILE__);
        $_ = sprintf('%u', $_);
        $_ = base_convert($_,10,36);
        $site_sessionname = 'evo' . $_;
        
        function removeInvalidCmsSessionFromStorage(&$storage, $session_name) {
          if (isset($storage[$session_name]) && $storage[$session_name] === '')
          {
            unset($storage[$session_name]);
          }
        }
        function removeInvalidCmsSessionIds($session_name) {
            // session ids is invalid iff it is empty string
            // storage priorioty can see in PHP source ext/session/session.c
            removeInvalidCmsSessionFromStorage($_COOKIE, $session_name);
            removeInvalidCmsSessionFromStorage($_GET, $session_name);
            removeInvalidCmsSessionFromStorage($_POST, $session_name);
        }
        function startCMSSession(){
            
            global $site_sessionname, $https_port;
            
            session_name($site_sessionname);
            removeInvalidCmsSessionIds($site_sessionname);
            session_start();
            $cookieExpiration= 0;
            $secure = ((isset ($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') || $_SERVER['SERVER_PORT'] == $https_port);
            
            if    (isset($_SESSION['mgrValidated'])) $context = 'mgr';
            elseif(isset($_SESSION['webValidated'])) $context = 'web';
            else {
                setcookie($site_sessionname, session_id(), $cookieExpiration, MODX_BASE_URL, null, $secure, true);
                return;
            }
            
            $key = "modx.{$context}.session.cookie.lifetime";
            if (isset($_SESSION[$key]) && is_numeric($_SESSION[$key])) {
                $cookieLifetime= intval($_SESSION[$key]);
                if($cookieLifetime) $cookieExpiration = $_SERVER['REQUEST_TIME']+$cookieLifetime;
            }
            if (!isset($_SESSION['modx.session.created.time'])) {
                $_SESSION['modx.session.created.time'] = $_SERVER['REQUEST_TIME'];
            }
            setcookie($site_sessionname, session_id(), $cookieExpiration, MODX_BASE_URL, null, $secure, true);
        }
    }
    
    



    What have I missed?
      • 13226
      • 953 Posts
      You probably have outdated snippets or modules in the DB

      Try changing "$database_type = 'mysqli';" to "$database_type = 'mysql';"

      If that works, you will have to go through your old code and change the "mysql" calls for the "mysqli" equivalents, then change the DB type back.
        • 53438
        • 16 Posts
        Quote from: iusemodx at May 05, 2017, 09:43 PM
        You probably have outdated snippets or modules in the DB

        Try changing "$database_type = 'mysqli';" to "$database_type = 'mysql';"

        If that works, you will have to go through your old code and change the "mysql" calls for the "mysqli" equivalents, then change the DB type back.

        Thanks for the reply. but where is "$database_type = 'mysqli';" ?
          • 13226
          • 953 Posts
          In your config file, that you posted in your first post

          Are you a developer ?