Weird Error: Fatal error: Class ‘CI_Controller’ not found in Codeigniter Framework

It’s a simply weird and misleading error message.  I was working on a client project which was actually based on Codeigniter  (CI) framework version 2.1.3.  Somehow, I did a typo in DB setting located at config/database.php file. But, I got a very weird error message: Fatal error: Class ‘CI_Controller’ not found in /var/www/my/……./system/core/CodeIgniter.php on line 233 as below….

CI ErrorAt a first glance, it seemed that there was a bug in CI Core class. But, it was actually a misleading message. It should have been a database connection error. And, after tracing out the error message properly with xdebug  (You must have xdebug installed in your PC to get the above error tracing), i got that there was error coming from DB drive. So, quickly checked the DB setting and fixed the typo.  But, In the mean time,  I already passed two hours for fixing. Finally, at least I saved my ass from losing two hours more. 😛

 

Eftakhairul Islam

Hi, I'm Eftakhairul Islam, a passionate Software Engineer, Hacker and Open Source Enthusiast. I enjoy writing about technical things, work in a couple of startup as a technical advisor and in my spare time, I contribute a lot of open source projects.

 

13 thoughts on “Weird Error: Fatal error: Class ‘CI_Controller’ not found in Codeigniter Framework

  1. Hi Eftakhairul,
    Thank you for leading me to right direction and not waste my 2 hours cuz of misleading error message.
    I had similar error message and spent few minutes. I tried re-uploading the system files too but of no use. Finally I found this post and checked my DB setting where my DB config was not right. Once i fixed it.. my site is up and running.

    Thank you so much.

    1. Thanks for your feedback. It will motivate me to write more posts like this one. Keep continue reading my blog. Some more interesting blog post is coming.

    2. Hello, i am still stuck with the same error perhaps i have changed database_name,username,password in database.php file according to the 000webhost.
      Please help me!

  2. Hey,

    This was really useful, I was about to spend time on this bug with CI controller and you save me.

    Thank you for posting this.

    Regards
    John

  3. I am getting the same error when I am checking the other pages which is coming from db that is working fine but when I am trying to login with form I am getting this error.

    any solution now?

  4. Hey!,
    I got same error. To remove that i changed my DB settings according to your advise.Now it is working fine.Then i downloaded “php_xdebug-2.3.3-5.6-vc11-x86_64.dll”. Where should i copy this file, please help???

Leave a Reply

Your email address will not be published.

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Read previous post:
Send email using Gmail SMTP from Rails 3 platform

Recently, I co-founded another and my second Startup: InternCity. The Platform is based on Ruby  (v-1.9.3) On Rails (v-3.2).  Developing...

Close