문제

I'm trying to set up my sessions so it would be stored in database, now it does just that but every time i try to login i keeps generating new session id and inserting new record, and the bigest problem that after i changed my session driver from native to database my login doesn't work, well it logins user but just after page refresh it's loged out, here ir my config:

return array(
    'native' => array(
        'name' => 'session_native',
        'lifetime' => 43200,
    ),
    'cookie' => array(
        'name' => 'session_cookie',
        'encrypted' => TRUE,
        'lifetime' => 43200,
    ),
    'database' => array(
        'name' => 'session_database',
        'encrypted' => TRUE,
        'lifetime' => 43200,
        'group' => 'default',
        'table' => 'sessions',
        'columns' => array(
            'session_id'  => 'session_id',
            'last_active' => 'last_active',
            'contents'    => 'contents'
        ),
        'gc' => 500,
    ),
);

and i've changed this line in my auth config from:

'session_type' => Session::$default,

To:

'session_type' => 'database',
도움이 되었습니까?

해결책

You also need to setup your cookie config.

Make sure your cookie domain is correct, it's probably the cause of throwing you out after login.

다른 팁

Try to add this in 'bootstrap.php'

Cookie::$salt = '021004042012';

The string are random key.

1) All the errors occuring while writing a session are logged, but not displayed.
2) In Kohana 3 you need to specify Cookie::$salt in order to use any sessions (native as well).

(search of these two facts was quite a puzzle for me while upgrading from Kohana 2)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top