0

We need to set session.gc_maxlifetime separately on the site and mobile (app). Is any best practices here?

UPD. My final solution looks as follows:

$args = arg();
$is_mob_rest_api = FALSE;
if (!empty($args)) {
  $is_mob_rest_api = $args[0] == 'api' && $args[1] == 'v1';
}
$session__gc_maxlifetime = $is_mob_rest_api ? 31536000 : 1440;
ini_set('session.gc_maxlifetime', $session__gc_maxlifetime);
  • 1
    hook_init() isn't invoked for cached pages, so likely not. hook_boot() is, though – Clive Jul 23 '15 at 13:38
1

if you set it always and for all, you should do it in settings.php

ini_set('session.gc_maxlifetime',  36000);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.