Hi I’ve been reading up on this and currently we have this as a solution:
ini_set("session.gc_maxlifetime", "28800");
ini_set('session.gc_probability',1);
ini_set('session.gc_divisor',1);
ini_set('session.cookie_lifetime','28800');
session_set_cookie_params(86400);
session_start();
However one of my colleges have been logged out, is there another solution perhaps using session_set_cookie_params or htaccess.
To what problem? Yes you want sessions to last longer….how long?
Why not change the values in your php.ini that way you don’t need to ensure that your code gets for every script and before calling session_start() (after all if you’ve got scripts which are triggering the garbage collection but DO NOT change the max_lifetime or cookie_lifetime then they’ll trash the session at the expiry of the values it is using).
Sets the session cookie lifetime to 8 hours
Sets the session cookie lifetime to 24 hours.
If you can’t be consistent between 2 adjacent lines of code….?