Post by shep91 » Fri Jan 13, 2017 3:00 am

Hello,

I've been searching for a long time and can't find a solution to my problem, it is causing some serious issues as we have orders which have been placed, but we cannot access our site to fulfill them so we are very concerned!

I am using opencart-2.0.1.1

Our website has been running fine for a couple of years with no problems after setting it up. We have made no changes recently and suddenly a few days ago have started receiving an error message when trying to log into our admin back end. The error reads:

Fatal error: Call to a member function get() on a non-object in /var/sites/p/paper-jungle.co.uk/public_html/admin/index.php on line 83

Line 83 of index.php reads:

Code: Select all

	if ($config->get('config_error_display')) {
		echo '<b>' . $error . '</b>: ' . $errstr . ' in <b>' . $errfile . '</b> on line <b>' . $errline . '</b>';
I have checked my config.php and it appears to be in order and hasn't been changed anyway. I found a suggestion to check session.php and config.php under the system/library directory of my store, I tried changing the permissions to both files to see if increasing the permissions would help, no luck. I also tried re-uploading the entire library directory from a local folder, no luck.

The only progress I have had so far was following a suggestion to change the code in my session.php file from:

Code: Select all

session_start();
To

Code: Select all

session_save_path(realpath(dirname($_SERVER['DOCUMENT_ROOT']) . '/../tmp'));
This made the error message disappear on the login page, however, it didn't actually fix the problem, the page just continues to refresh upon entering our credentials.

Please if anyone could shed any light on this it would be a real help!

Newbie

Posts

Joined
Fri Jan 13, 2017 2:45 am

Post by Tomit » Fri Jan 13, 2017 7:38 am

It looks like $config is not an object, so for some reason it didn't load the config object, can you make sure the file exists : system/library/config.php

and also admin/config.php?

Image


New member

Posts

Joined
Sat Sep 14, 2013 9:54 pm
Location - Netherlands

Post by shep91 » Fri Jan 13, 2017 8:35 am

Thank you for the reply Tomit. Both system/library/config.php and admin/config.php exist on the server. The config.php within system/library reads:

Code: Select all

<?php
class Config {
	private $data = array();

	public function get($key) {
		return (isset($this->data[$key]) ? $this->data[$key] : null);
	}

	public function set($key, $value) {
		$this->data[$key] = $value;
	}

	public function has($key) {
		return isset($this->data[$key]);
	}

	public function load($filename) {
		$file = DIR_CONFIG . $filename . '.php';

		if (file_exists($file)) {
			$_ = array();

			require($file);

			$this->data = array_merge($this->data, $_);
		} else {
			trigger_error('Error: Could not load config ' . $filename . '!');
			exit();
		}
	}
}
The config.php in admin reads:

Code: Select all

<?php
// HTTP
define('HTTP_SERVER', 'http://www.paper-jungle.co.uk/admin/');
define('HTTP_CATALOG', 'http://www.paper-jungle.co.uk/');

// HTTPS
define('HTTPS_SERVER', 'http://www.paper-jungle.co.uk/admin/');
define('HTTPS_CATALOG', 'http://www.paper-jungle.co.uk/');

// DIR
define('DIR_APPLICATION', '/var/sites/p/paper-jungle.co.uk/public_html/admin/');
define('DIR_SYSTEM', '/var/sites/p/paper-jungle.co.uk/public_html/system/');
define('DIR_LANGUAGE', '/var/sites/p/paper-jungle.co.uk/public_html/admin/language/');
define('DIR_TEMPLATE', '/var/sites/p/paper-jungle.co.uk/public_html/admin/view/template/');
define('DIR_CONFIG', '/var/sites/p/paper-jungle.co.uk/public_html/system/config/');
define('DIR_IMAGE', '/var/sites/p/paper-jungle.co.uk/public_html/image/');
define('DIR_CACHE', '/var/sites/p/paper-jungle.co.uk/public_html/system/cache/');
define('DIR_DOWNLOAD', '/var/sites/p/paper-jungle.co.uk/public_html/system/download/');
define('DIR_UPLOAD', '/var/sites/p/paper-jungle.co.uk/public_html/system/upload/');
define('DIR_LOGS', '/var/sites/p/paper-jungle.co.uk/public_html/system/logs/');
define('DIR_MODIFICATION', '/var/sites/p/paper-jungle.co.uk/public_html/system/modification/');
define('DIR_CATALOG', '/var/sites/p/paper-jungle.co.uk/public_html/catalog/');

// DB
define('DB_DRIVER', 'mysqli');
define('DB_HOSTNAME', 'removed for security');
define('DB_USERNAME', 'removed for security');
define('DB_PASSWORD', 'removed for security');
define('DB_DATABASE', 'removed for security');
define('DB_PREFIX', 'oc_');
I also tried removing the www. from the domain, it had no effect.

Newbie

Posts

Joined
Fri Jan 13, 2017 2:45 am

Post by shep91 » Fri Jan 13, 2017 11:31 am

I finally managed to fix this issue! For anyone who's searching for the answer... I added the following code:

Code: Select all

session.save_path = /tmp;
to the bottom of the php.ini file.

I can't explain why this worked and definitely can't explain why the problem happened in the first place, if anyone could shed any light on it for future reference that would be great :). But aside from that I consider this post solved.

Newbie

Posts

Joined
Fri Jan 13, 2017 2:45 am

Post by Tomit » Fri Jan 13, 2017 4:13 pm

shep91 wrote:I finally managed to fix this issue! For anyone who's searching for the answer... I added the following code:

Code: Select all

session.save_path = /tmp;
to the bottom of the php.ini file.

I can't explain why this worked and definitely can't explain why the problem happened in the first place, if anyone could shed any light on it for future reference that would be great :). But aside from that I consider this post solved.
Good job :) the error is pretty vague, I wouldn't think that was the issue..

Image


New member

Posts

Joined
Sat Sep 14, 2013 9:54 pm
Location - Netherlands
Who is online

Users browsing this forum: No registered users and 56 guests