CodeIgniter CI_Controller not found
I guess this error occurs when a log library function is called before CI_Controller class is loaded. This could happen in an early stage of your application routine. So you should extend the log library without using $this->$CI =& get_instance();
.
Quite strange. I just replicated your case (with the info provided) and I encountered no problems. But make sure of a couple things:
- Your file is named MY_Log.php, and is located in
application/libraries/My_log.php
- The file extends the parent class, in this case CI_Log
You call the library in your controller as
$this->load->library('log');$this->log->do_something();
i.e, not using "My_log" but the parent library's name. In fact, you're extending it, not creating a different one, so CI wants you to call it the same as the original
Your original file has the following line correctly written (without the $ sign before CI)
$this->CI =& get_instance();
My test case with your code provided works fine on my development machine (Windows 7 WAMP php 5.3.8). I'll be waiting for more infos.
Try putting this at the top of MY_Log.php if you haven't already:
<?php defined('BASEPATH') OR exit('No direct script access allowed');
It's possible that your class MY_Log isn't actually being parsed by php if it's not included in the php delimiters. If that's the case, then CI would see the file MY_Log.php, and expect CI_Log to be extended by the class declared in MY_Log.php. But, if your class isn't within PHP delimiters, CI_Log wouldn't actually be extended, which could cause odd errors.