Page 1 of 1

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

Posted: Fri Oct 05, 2012 8:16 am
by tora0515
Trying to move from local host to new server. fresh install worked fine, no problems. When I uploaded my files from localhost 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:

Code: Select all

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):

Code: Select all

<?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:

Code: Select all

<?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.

Re: Fatal error: Call to a member function get() on a non-ob

Posted: Fri Oct 05, 2012 10:47 pm
by anung
Open the system setting, in tan server, check if * Error Log Filename: is right name (error.txt) then try to disable Display Errors: --> save.

Re: Fatal error: Call to a member function get() on a non-ob

Posted: Thu Mar 26, 2015 11:25 pm
by micrdy
Have you managed to solve this issue? Got the same

Re: Fatal error: Call to a member function get() on a non-ob

Posted: Sun Jun 07, 2015 12:48 am
by ibrahim786
Hi, I am using opencart v2.0.1.1 i am getting error below

Fatal error: Call to a member function getUserName() on a non-object in /home/appro/public_html/imperial/admin/controller/common/header.php on line 41
$data['text_logged'] = sprintf($this->language->get('text_logged'), $this->user->getUserName());
above line is default on my public_html how can i fix this problem please help mee!!!!

Re: Fatal error: Call to a member function get() on a non-ob

Posted: Fri Jun 12, 2015 3:03 pm
by micrdy
ibrahim786 wrote:Hi, I am using opencart v2.0.1.1 i am getting error below

Fatal error: Call to a member function getUserName() on a non-object in /home/appro/public_html/imperial/admin/controller/common/header.php on line 41
$data['text_logged'] = sprintf($this->language->get('text_logged'), $this->user->getUserName());
above line is default on my public_html how can i fix this problem please help mee!!!!
Obviously the object "user" is not avilable. Takte a look here:
http://wiki.opencarthelp.com/doku.php?i ... tfirstname

There you can get the user credentials with $this->customer->get[...]

Re: Fatal error: Call to a member function get() on a non-ob

Posted: Wed Aug 24, 2016 2:41 pm
by sumon
Why show this message--- Fatal error: Call to a member function get() on null in C:\xampp\htdocs\shop\system\engine\front.php on line 45