Recently, I've been getting logged out sooner than expected on several websites that I manage on Linux servers. The problem started spontaneously a few months ago. At the time, I had not made any recent changes to the website code or the CPanel settings. There was no need to, because my CPanel settings always kept me logged in for about 18 hours. But now I'm getting logged out after just 30 minutes of inactivity. Here are the CPanel settings that worked reliably until a few months ago:
session.cookie_lifetime 0 session.gc_maxlifetime 65535
For troubleshooting, I've also tried the equivalent settings in the htaccess file:
php_value session.cookie_lifetime 0 php_value session.gc_maxlifetime 65535
(65535 seconds is equivalent to about 18 hours.)
I've tested this problem with three different PHP forms. First, I log in with a user name and password. If I then press F5 to refresh within 30 minutes, I am still logged in. But if I wait longer than 30 minutes before refreshing the page, I find that I have been logged out. Also, I've tried two different servers provided by the same web host, but the problem remains.
I'm on a shared CentOS server, and I don't have access to the php.ini file -- only the CPanel and
I suspect this problem has been caused by a recent Linux / CentOS update, but I don't see similar complaints on the internet. So I wonder if it's just my web host. (They are otherwise very reliable.)
Has anyone encountered this problem? Is it a Linux / CentOS bug? Is there a fix? Or should I move to another web host?