Error 500 when calling get_instance from a library in CodeIgniter

I am trying to expand the CodeIgniter log library with additional information that I download from the Session library. This seems possible according to the information here: http://codeigniter.com/user_guide/general/creating_libraries.html

So, I created a file in the application / libraries called MY_Log.php with the following:

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class MY_Log extends CI_Log { function __construct() { parent::__construct(); $CI =& get_instance(); $CI->load->library('session'); } } ?> 

The problem is that whenever I call get_instance from this file, I get "500 Server Internal Error". I tried replacing my codeigniter system directory with a fresh copy of the latest version (2.1.2), but I am getting the same error. What am I doing wrong?

Thanks in advance.

+1
source share
1 answer

The CI_Log library no longer exists - this, in turn, also means that the MY_Log.php file inside the core folder will no longer be loaded automatically.

This means that you must remove the extension of the previous class and implement the necessary functions in your library.

For the futere link, when you get a 500 server error, you can check the error log on your server. Most likely, he will tell you what is wrong.

+1
source

All Articles