C
C
Crash2018-08-17 11:30:24
Yii
Crash, 2018-08-17 11:30:24

How to extend the lifetime of a session variable?

I set the variable like this:

Yii::$app->session->set('currentSite', $currentSite);

The config is written like this:
'session' => [
    // this is the name of the session cookie used for login on the backend
    'class' => 'yii\web\Session',
    'timeout' => 86400
],

But the variable is more than the standard value (1440 seconds) still does not hold. What am I doing wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis, 2018-08-17
@sidni

maybe the problem is in php itself
ini_set('session.gc_maxlifetime', 86400);
ini_set('session.cookie_lifetime', 86400);
if the hosting is not yours, then you can still use:
ini_set('session.save_path', $_SERVER['DOCUMENT_ROOT'] .'../sessions/');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question