We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

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.