CodeIgniter Forums
Unable to locate the specified class: Session.php - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Installation & Setup (https://forum.codeigniter.com/forumdisplay.php?fid=9)
+--- Thread: Unable to locate the specified class: Session.php (/showthread.php?tid=66201)

Pages: 1 2


Unable to locate the specified class: Session.php - jophof007 - 09-19-2016

This weekend I migrated to version 3.1 coming from 2.2.6.

Unable to locate the specified class: Session.php

I googled and a lot of hits but not the right one for me.

In autoload.php I have:


PHP Code:
$autoload['libraries'] = array('database''user_agent');
$autoload['drivers'] = array('session'); 

But I am wondering what is the best way to use sessions in my controller.


Is thrown in my first sub class derived as follows.


PHP Code:
class MY_Ezbuild extends CI_Controller {

  function __construct() {
    ob_start();
    parent::__construct();
    $this->outputdir "/htdocs/b4y_v18/";
    $this->load->library('session'); 

Here fore I need session data in my construct of MY_Ezbuild:



PHP Code:
    $this->session->set_userdata('language''NL');
    $this->session->set_userdata('poolID''1');
    $this->session->set_userdata('labelID''1'); 

Any help more than appreaceated.


John




RE: Unable to locate the specified class: Session.php - salain - 09-20-2016

Load the session as a library


RE: Unable to locate the specified class: Session.php - jophof007 - 09-20-2016

(09-20-2016, 01:48 AM)salain Wrote: Load the session as a library

But how?


RE: Unable to locate the specified class: Session.php - InsiteFX - 09-20-2016

As salain said you autoload the session as a library with the database you do not load a driver for it.


RE: Unable to locate the specified class: Session.php - jophof007 - 09-20-2016

Code:
$this->load->library('session');

Is this not loading it as a library?

John


RE: Unable to locate the specified class: Session.php - salain - 09-20-2016

Yes it is.
You don't have to autoload as a driver.


RE: Unable to locate the specified class: Session.php - dave friend - 09-20-2016

Just to be perfectly clear. What everybody is saying is...

Change this

Code:
$autoload['libraries'] = array('database', 'user_agent');
$autoload['drivers'] = array('session');

to this

Code:
$autoload['libraries'] = array('database', 'user_agent', 'session');



RE: Unable to locate the specified class: Session.php - mwhitney - 09-20-2016

(09-20-2016, 07:17 AM)dave friend Wrote: Just to be perfectly clear. What everybody is saying is...

Change this

Code:
$autoload['libraries'] = array('database', 'user_agent');
$autoload['drivers'] = array('session');

to this

Code:
$autoload['libraries'] = array('database', 'user_agent', 'session');

Yes.

However, I would note that this shouldn't make a difference in determining whether the session library works. Putting it in the drivers array just means that it will also load the CI_Driver_Library class, which you don't need for the session library.

If you're autoloading the library, you don't need to load it again in your controller, but that still shouldn't be causing the problem you're describing.

One potential area for this error would be any hooks you might have configured which attempt to use the session library, especially pre_system, cache_override, and pre_controller hooks.


RE: Unable to locate the specified class: Session.php - Narf - 09-20-2016

Do you still have system/libraries/Session.php ?

If so, follow the upgrade instructions strictly. You've messed up on the very first step, ignoring the note maked as "Important".


RE: Unable to locate the specified class: Session.php - jophof007 - 09-20-2016

I have followed the migration steps step by step. I can't see what am I doing wrong.
Can you be more specific?
I don't have any hooks just plain vanilla usage of database and sessions in my web-app. So no views, models or other things.

John