1

How to change the default session time in phalcon framework without changing the php.ini file. I am using the below code for starting session in phalcon framework. Any suggestion is most welcome.

$di->setShared('session', function() {
            $session = new SessionAdapter();
            $session->start();
            return $session;
        });
MANOJ
  • 177
  • 5
  • 14

1 Answers1

9

There currently isn't a way of doing this in Phalcon itself, you can however try this:

$di->setShared('session', function() {

    // Set the max lifetime of a session with 'ini_set()' to one hour
    ini_set('session.gc_maxlifetime', 3600);
    session_set_cookie_params(3600);

    // Start session with Phalcon
    $session = new SessionAdapter();
    $session->start();
    return $session;
});

See this question for more information

Community
  • 1
  • 1
Paradoxis
  • 4,471
  • 7
  • 32
  • 66