srs123
srs123

Reputation: 91

Fatal error: Class 'Config' not found in opencart

I have taken a copy of an OpenCart installation (version 2.0.3.1) and put on to Windows localhost.

I've fixed a couple of the issues, but I've now come up against an error that I can't resolve:

Fatal error: Class 'Config' not found in ..\index.php on line 31

I've searched Google, but no-one else seems to have come across the same problem.

Can someone tell me where this class resides?

The relevant lines in the index.php file are:

   CODE: 

   23    // Registry
   24    $registry = new Registry();
   25    
   26    // Loader
   27    $loader = new Loader($registry);
   28    $registry->set('load', $loader);
   29    
   30    // Config
   31    $config = new Config(); // HERE
   32    $registry->set('config', $config);

Upvotes: 3

Views: 7871

Answers (2)

MistaJase
MistaJase

Reputation: 849

I got this error - but it was due to me adding config.php to my .gitignore file.

I only wanted to ignore my settings files but this caused the config.php class file to also be ignored from the /system/library folder (same name!)

just make sure that config.php exists in the library folder - but make sure it contains config class - not your oc settings!

Upvotes: 5

Sanket Ghorpade
Sanket Ghorpade

Reputation: 86

I faced the same issue while integrating it on the local machine. Follow these steps, it might help:-

  1. Download the opencart package of version 2.0.3.1 from the website or download from this link: https://www.opencart.com/index.php?route=download/download/success&download_id=41
  2. Open the downloaded folder and navigate to System/library folder.
  3. Copy config.php file from there and paste in your project location in the same folder System/library.
  4. It will ask to replace the file, do that and it should solve the problem.

Also, make sure you have written something like this on top of index file or not require_once('config.php');

I hope this helps.

Upvotes: 4

Related Questions