Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Extending session timeout in PHP via the .htaccess

I want to up the time my users will stay logged into my site without getting automatically logged out after a period of inactivity. I'm tracking the logged in status using PHP sessions.

How can I set this, I'm trying to control this from my .htaccess file.

like image 995
Ian Avatar asked Feb 05 '09 01:02

Ian


2 Answers

You can't do that from the htaccess file but You can change this line in your php.ini file.

session.gc_maxlifetime = 1440

Update: it seems to be possible, so i stand corrected

php_value session.gc_maxlifetime 3600

I haven't tried this out though.

like image 194
Ólafur Waage Avatar answered Nov 06 '22 05:11

Ólafur Waage


You could also try changing the value at runtime using ini_set:

ini_set('session.gc_maxlifetime', '3600');
like image 7
Asciant Avatar answered Nov 06 '22 04:11

Asciant