(Solved) Unable to load the requested class: Session | Codeigniter

This is a small hindrance that can cause a huge headache. It usually happens when you are trying to load session more than once or there are some files missing in the system folder. In my case it was solved rather simply, I just copied the system folder from a working project and and replace the system folder in the non working project with this one. If this still doesn't fix your issue you can try and perform the following steps, I am sure one of these will work out in your favor.

Fixing Unable to load the requested class: Session

  • Make sure you load the session library in autload.php:  
  • $autoload['libraries'] = array('session'); 
  • Make sure your encryption key is set in cofing.php:
  • $config['encryption_key'] = 'any random sequence here' 
  • If you are on Unix/Linux, make sure to load your library with capital letters: $autoload['libraries'] = array('Session');

  • In you config file inside application/config/config.php set the session variable to these values- $config['sess_cookie_name']        = 'ci_session';
    $config['sess_expiration']        = 7200;
    $config['sess_expire_on_close']    = FALSE;
    $config['sess_encrypt_cookie']    = FALSE;
    $config['sess_use_database']    = FALSE;
    $config['sess_table_name']        = 'ci_sessions';
    $config['sess_match_ip']        = FALSE;
    $config['sess_match_useragent']    = TRUE;
    $config['sess_time_to_update']    = 300;
If none of the above steps fix your problem then replace your system folder with the system folder of a working project or download and do a fresh install of Codeigniter from http://www.codeigniter.com/download.

Comments