Welcome Guest, Not a member yet? Register   Sign In
[Solved] Session dont working - Class 'database' not found
#1

(This post was last modified: 10-19-2018, 01:28 AM by ciadmin.)

Hello!

I create session variable - $session=\Config\Services:Confusedession();
But I get an error in the logs - Class 'database' not found
For any of the database driver options (files, database), I get this error. 
(Class 'files' not found - if sessions driver set is "files").

Help please.
Reply
#2

Check application/Config/App ... in CI4, you provide the name of the session handling class, eg 'CodeIgniter\Session\Handlers\FileHandler', instead of just 'files'.
Reply
#3

settings from docs:

public $sessionDriver   = 'database';
public $sessionSavePath = 'ci_sessions';



You mean it should be like this?

public $sessionDriver   = 'CodeIgniter\Session\Handlers\DatabaseHandler';
public $sessionSavePath = 'ci_sessions';



or what?
Reply
#4

(This post was last modified: 10-19-2018, 12:41 AM by ciadmin.)

That is right. I think you just uncovered an error in the user guide Undecided

I have raised a bug report!
Reply
#5

Settings
public $sessionDriver            = 'CodeIgniter\Session\Handlers\DatabaseHandler';
public $sessionSavePath          = 'ci_sessions';

it still does not work - CRITICAL - 2018-10-19 02:46:06 --> Object of class CodeIgniter\Session\Handlers\DatabaseHandler could not be converted to string
Reply
#6

Oh dear - then I have misinterpreted something somewhere Undecided Will dig further.
Reply
#7

Where is that error message happening. The source code looks like it expects a class name.
Reply
#8

Problem is here:
$driver = new $driverName($config); (System\Config\Services - line 679)
where $driverName is "database" (from application\Config\App)
but class "database" is missing

What class should the variable be equal here?
Reply
#9

Sorry, my mistake, this:
public $sessionDriver            = '\CodeIgniter\Session\Handlers\DatabaseHandler';

work fine, thanks a lot!
Reply
#10

Smile
Reply




Theme © iAndrew 2016 - Forum software by © MyBB