Unable to locate the specified class: Session.php |
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'); 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 { Here fore I need session data in my construct of MY_Ezbuild: PHP Code: $this->session->set_userdata('language', 'NL'); Any help more than appreaceated. John
Load the session as a library
A good decision is based on knowledge and not on numbers. - Plato
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 )
Code: $this->load->library('session'); Is this not loading it as a library? John
Yes it is.
You don't have to autoload as a driver. A good decision is based on knowledge and not on numbers. - Plato
Just to be perfectly clear. What everybody is saying is...
Change this Code: $autoload['libraries'] = array('database', 'user_agent'); to this Code: $autoload['libraries'] = array('database', 'user_agent', 'session'); (09-20-2016, 07:17 AM)dave friend Wrote: Just to be perfectly clear. What everybody is saying is... 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.
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".
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 |
Welcome Guest, Not a member yet? Register Sign In |