We recently migrated from a Windows 2003 server running xamp, to a Centos server running apache with PHP Version 5.3.3.
Originally, the issue was that users were being logged out after about 24 minutes, so I changed the INI variable session.save_path
, which resolved the problem. However, some users are still periodically being logged out of our website, seemingly at random. It happens to multiple users using different browsers at different times. Sometimes after having the page sit unused, but sometimes while browsing from one page to another.
Here are our session-related INI settings:
session.save_handler = files
session.save_path = "/var/sessions"
session.use_cookies = 1
;session.cookie_secure =
;session.use_only_cookies = 1
session.name = PHPSESSID
session.auto_start = 0
session.cookie_lifetime = 86400
session.cookie_path = /
session.cookie_httponly =
session.serialize_handler = php
session.gc_probability = 1
session.gc_divisor = 1000
session.gc_maxlifetime = 86400
session.bug_compat_42 = Off
session.bug_compat_warn = On
session.referer_check =
session.entropy_length = 0
session.entropy_file =
;session.entropy_length = 16
session.cache_limiter = nocache
At first I thought it might have been an issue with the cookie in the browser, as one of the users had his cookie set to never expire even though the code sets the cookie to expire after 24 hours. But, after deleting the cookie and having him log back in, it set the cookie properly to 24 hours, and he had the same issue of being logged out prematurely.
I have created a cron job script that deletes all the sessions every morning at 4am since the sessions have been moved out of the tmp directory.
I discovered today that the sessions on the server aren't being deleted, but a new session with a new session ID is being created when the users log back in, even though they still have an existing session on the server.
Any assistance would be greatly appreciated.