Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apache making the session time out longer

I already altered my php.ini in Apache to have these settings:

session.gc_maxlifetime = 1440
session.cache_expire = 1500

But my sessions are not that long. The problem is that I am not certain which settings would "do the trick"

Ideally I am looking for the right configuration to have the session last 12 hours. Could anyone help me with that?

like image 322
Genadinik Avatar asked Jun 12 '11 19:06

Genadinik


People also ask

What is the default timeout in Apache?

However, the default setting for Apache Keepalive Timeout is 15 seconds. In computer terms, this is an eternity. If it takes 2 seconds to load a webpage, then, the slot is active for 2 seconds, serving requests, and then waits 15 seconds longer, waiting to see if the user needs anything else.

What can cause session timeout?

If your Internet connection is unstable, periodically disconnecting and reconnecting, it can cause a website session to expire. When the Internet connection is lost the website connection can be terminated, resulting in a session expired message if you try to access any page after the Internet reconnects.


1 Answers

session.gc_maxlifetime is measured in seconds, so your setting of 1440 will expire after 24 minutes. (see: http://php.net/session.gc-maxlifetime)

For 12 hour session I believe you need:

session.gc_maxlifetime = 43200
session.cache_expire = 720
session.cookie_lifetime = 0 
like image 173
SuprMan Avatar answered Oct 12 '22 16:10

SuprMan