Opencart Fatal error: Call to a member function get() on a non-object

Travis picture Travis · Oct 5, 2012 · Viewed 25.7k times · Source

Trying to move from local host to new server. Fresh install worked fine, no problems. When I uploaded my files mydomain.com/admin comes up with a white screen and mydomain.com produces this error:

Fatal error: Call to a member function get() on a non-object in /home4/pawpostc/public_html/index.php on line 103.

So I took a look at index.php line 103:

if ($config->get('config_error_display')) {
        echo '<b>' . $error . '</b>: ' . $errstr . ' in <b>' . $errfile . '</b> on     line <b>' . $errline . '</b>';
    }

Seems like there is a problem with my config files. So I went and had a look at them. I have gone over them a few times but can not find the mistake, probably missing something, so here are the config files.

config.php (in my root www. folder):

<?php
// HTTP
define('HTTP_SERVER', 'http://www.pawpost.com.au/');
define('HTTP_IMAGE', 'http://www.pawpost.com.au/image/');
define('HTTP_ADMIN', 'http://www.pawpost.com.au/admin/');

// HTTPS
define('HTTPS_SERVER', 'http://www.pawpost.com.au/');
define('HTTPS_IMAGE', 'http://www.pawpost.com.au/image/');

// DIR
define('DIR_APPLICATION', '/home4/pawpostc/public_html/catalog/');
define('DIR_SYSTEM', '/home4/pawpostc/public_html/system/');
define('DIR_DATABASE', '/home4/pawpostc/public_html/system/database/');
define('DIR_LANGUAGE', '/home4/pawpostc/public_html/catalog/language/');   
define('DIR_TEMPLATE', '/home4/pawpostc/public_html/catalog/view/theme/');
define('DIR_CONFIG', '/home4/pawpostc/public_html/system/config/');
define('DIR_IMAGE', '/home4/pawpostc/public_html/image/');
define('DIR_CACHE', '/home4/pawpostc/public_html/system/cache/');
define('DIR_DOWNLOAD', '/home4/pawpostc/public_html/download/');
define('DIR_LOGS', '/home4/pawpostc/public_html/system/logs/');

// DB
define('DB_DRIVER', 'mysql');
define('DB_HOSTNAME', 'localhost');
define('DB_USERNAME', 'my user name');
define('DB_PASSWORD', 'my password');
define('DB_DATABASE', 'my database');
define('DB_PREFIX', 'oc_');
?>

admin/config.php:

<?php
// HTTP
define('HTTP_SERVER', 'http://www.pawpost.com.au/admin/'); 
define('HTTP_CATALOG', 'http://www.pawpost.com.au/');
define('HTTP_IMAGE', 'http://www.pawpost.com.au/image/');

// HTTPS
define('HTTPS_SERVER', 'http://www.pawpost.com.au/admin/');
define('HTTPS_CATALOG', 'http://www.pawpost.com.au/');
define('HTTPS_IMAGE', 'http://www.pawpost.com.au/image/');

// DIR
define('DIR_APPLICATION', '/home4/pawpostc/public_html/admin/');
define('DIR_SYSTEM', '/home4/pawpostc/public_html/system/');
define('DIR_DATABASE', '/home4/pawpostc/public_html/system/database/');
define('DIR_LANGUAGE', '/home4/pawpostc/public_html/admin/language/');
define('DIR_TEMPLATE', '/home4/pawpostc/public_html/admin/view/template/');
define('DIR_CONFIG', '/home4/pawpostc/public_html/system/config/');
define('DIR_IMAGE', '/home4/pawpostc/public_html/image/');
define('DIR_CACHE', '/home4/pawpostc/public_html/system/cache/');
define('DIR_DOWNLOAD', '/home4/pawpostc/public_html/download/');
define('DIR_LOGS', '/home4/pawpostc/public_html/system/logs/');
define('DIR_CATALOG', '/home4/pawpostc/public_html/catalog/');

// DB
define('DB_DRIVER', 'mysql');
define('DB_HOSTNAME', 'localhost');
define('DB_USERNAME', 'my user name');
define('DB_PASSWORD', 'my password');
define('DB_DATABASE', 'my database');
define('DB_PREFIX', 'oc_');
?>

Any help on this would be appreciated.

Answer

carley picture carley · Mar 13, 2013

I was using opencart and installed vqmod. All of a sudden I have one of the same errors.

This solved my problem: in system/library/session.php replace start session with:

session_save_path(realpath(dirname($_SERVER['DOCUMENT_ROOT']) . '/../tmp'));