Welcome Guest, Not a member yet? Register   Sign In
Unable to locate the specified class: Session.php
#1

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

Reply
#2

Load the session as a library
A good decision is based on knowledge and not on numbers. - Plato

Reply
#3

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

But how?
Reply
#4

As salain said you autoload the session as a library with the database you do not load a driver for it.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#5

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

Is this not loading it as a library?

John
Reply
#6

Yes it is.
You don't have to autoload as a driver.
A good decision is based on knowledge and not on numbers. - Plato

Reply
#7

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');
Reply
#8

(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.
Reply
#9

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".
Reply
#10

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
Reply




Theme © iAndrew 2016 - Forum software by © MyBB