Yannis Sintos Posted February 17, 2016 Share Posted February 17, 2016 Hello, I have moved a CubeCart 3.0.15 website from an old host to my new host using a cpanel backup. Although the site is running great, when i try to reach the admin bckend at domain.com/admin i get the following error. Fatal error: Class 'db' not found in /home/domain/public_html/admin/index.php on line 21 I use php 5.3 and i also switched to 5.2, 5.4, 5.5, but with no luck. Any help would be greatly appreciated !!! Quote Link to comment Share on other sites More sharing options...
bsmither Posted February 17, 2016 Share Posted February 17, 2016 In CC3015, the file /admin/index.php should have the following at the lines specified: Lines 24-40: +-------------------------------------------------------------------------- | index.php | ======================================== | Admin Homepage +-------------------------------------------------------------------------- */ include("../includes/ini.inc.php"); include_once("../includes/global.inc.php"); include_once("../classes/db.inc.php"); $db = new db(); include_once("../includes/functions.inc.php"); $config = fetchDbConfig("config"); include_once("../language/".$config['defaultLang']."/lang.inc.php"); $enableSSl = 1; include_once("../includes/sslSwitch.inc.php"); include_once("includes/auth.inc.php"); include_once("includes/header.inc.php"); Using your Cpanel's File Explorer and its Editor, view the contents of that file and compare those lines. Your file may be damaged, or, at least, the line numbers do not match. I was going to say that the new host may have given you a PHP installation that only connects to the database with the mysqli extension. CC3 only understands the mysql extension. But you say the rest of the store is functioning fine. So, that can't be the cause. Quote Link to comment Share on other sites More sharing options...
Yannis Sintos Posted February 17, 2016 Author Share Posted February 17, 2016 In /includes/global.inc.php are these lines correct ? $glob['adminURL'] = '/admin/'; $glob['adminURL2'] = '/admin' The lines in my /admin/index.php file are: +-------------------------------------------------------------------------- | index.php | ======================================== | Admin Homepage +-------------------------------------------------------------------------- */ include("../includes/ini.inc.php"); include_once("../includes/global.inc.php"); include_once("".$glob['adminURL2'] ."/adminfunctions.inc.php"); $db = new db(); include_once("../includes/functions.inc.php"); $config = fetchDbConfig("config"); include_once("../language/".$config['defaultLang']."/adminlang.inc.php"); $enableSSl = 1; include_once("../includes/sslSwitch.inc.php"); include_once("includes/auth.inc.php"); include_once("includes/header".$config['cms_edition'].".inc.php"); Quote Link to comment Share on other sites More sharing options...
bsmither Posted February 18, 2016 Share Posted February 18, 2016 Either you missed copying these lines, or the second statement is not correct: $glob['adminURL'] = '/admin/'; $glob['adminURL2'] = '/admin' There is no ending semi-colon on the second line. But an error here would cause a PHP error that would prevent any part of CubeCart from working. In your /admin/index.php file, please identify line 21. Quote Link to comment Share on other sites More sharing options...
Yannis Sintos Posted February 18, 2016 Author Share Posted February 18, 2016 Was my mistake, i didn't copy the semi-colon. Line 21 is: $db = new db(); Quote Link to comment Share on other sites More sharing options...
keat Posted February 18, 2016 Share Posted February 18, 2016 My V3 is 3.18 I believe. This is what's inside my index.php. +-------------------------------------------------------------------------- | index.php | ======================================== | Admin Homepage +-------------------------------------------------------------------------- */ include("../includes/ini.inc.php"); include_once("../includes/global.inc.php"); include_once("../classes/db.inc.php"); $db = new db(); include_once("../includes/functions.inc.php"); $config = fetchDbConfig("config"); include_once("../language/".$config['defaultLang']."/lang.inc.php"); $enableSSl = 1; include_once("../includes/sslSwitch.inc.php"); include_once("includes/auth.inc.php"); include_once("includes/header.inc.php"); Quote Link to comment Share on other sites More sharing options...
bsmither Posted February 18, 2016 Share Posted February 18, 2016 I really think that if the storefront is working, then access to the database is also working. There is one difference between the code in /index.php and /admin/index.php -- the 'parent folder' symbol. Here's the difference: /index.php include_once("classes/db.inc.php"); $db = new db(); /admin/index.php include_once("../classes/db.inc.php"); $db = new db(); Because the admin's index.php is one folder down, it has to use the double-dot symbol to traverse one folder level up so that the /classes/ folder can be reached. I recall working with one CubeCart store owner where it was discovered the hosting provider was extraordinarily paranoid about the server's security, and disallowed the use of the file system's double-dot traversal symbol. (Actually, it was a series of four or more double-dot symbols.) At this time, all I can suggest is that you contact your hosting company and ask if there is any security measure in place that might affect file system traversal. You might also try to find PHP's error log in your Cpanel. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.