We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Session won't timeout

Hi,

I am not sure if there is a bug raised or I am doing something totally wrong but I am setting my session like so:

    $session = new SessionAdapter();

    $session->setOptions(array('lifetime' => 60));

    $session->start();
    return $session;

When I do:

    var_dump($session->getOptions());

It returns int(60)

I then check if the session has expired after 60 seconds, 60 minutes, 60 hours and it never expired, am I doing something wrong ?

I was thinking maybe the php.ini timeout value could be overwriting it ?



1.8k
Accepted
answer
edited Apr '14

This has been fixed I did the following:

    $session = new SessionAdapter();

    session_set_cookie_params(3600);

    $session->start();
    return $session;

@digitronac helped with this and all credit goes to him.