I have this in my header script:

session_cache_expire (240);

It is at the very top and no errors are reported when it is called. The problem is that it doesn’t seem to work. It still times out at 30 min vice 4 hours. Anyone know what could cause this?



Ok, if you are sure that script is fine (All page) then check PHP.ini file

There are 2 lines that might have affect:

session.gc_maxlifetime = 1444 //
Garbage Life time, if cookie is considered as g and will be rebuved by g collectors

session.cookie_lifetime = 0 //
Regular lifetime, if 0 then till the browser restarts


There should be an other option to set the session’s cookie length.


Do you know what the other option could be. Here is what we changed the php.ini file to read:
session.gc_maxlifetime 18000
session.cookie_lifetime 0


0 should be infinite, which is probably not what you want.


According to manual, session.cookie_lifetime 0 mean that if your browser was closed your session is destroyed

0 is not an infinity in this case


Going by those settings it should work, But it is still timming out within a half an hour.


Whats your server OS and webserver?


Linux and Apache.

Thanks for any help.


I don’t know linux, check maybe there are some permissions in OS that store session data seperatly? Like on windows Machine_IUSER remote access session setings.