- session_set_cookie_params(0, $CFG->sessioncookiepath, $CFG->sessioncookiedomain, $cookiesecure, $CFG->cookiehttponly);
+ // The session cookie expiry time cannot be extended so this needs to be set to a reasonable period, longer than
+ // the sessiontimeout.
+ // This ensures that the cookie is unlikely to timeout before the session does.
+ $sessionlifetime = $CFG->sessiontimeout + WEEKSECS;
+ session_set_cookie_params($sessionlifetime, $CFG->sessioncookiepath, $CFG->sessioncookiedomain,
+ $cookiesecure, $CFG->cookiehttponly);