PHP sessions * don't always * work

I recently moved a bunch of websites to the new VPS and am having trouble with PHP sessions. All websites are pretty much the same, but there is one website where sessions don't always work. What bothers me is an accident. I can go to the site, log in, and the session will work fine. Then, I'll be back in an hour, try logging into the same account, but it no longer supports the session.

VPS runs on CentOS 5.8 and has PHP 5.4.3 . It should be noted that prior to the migration, the website worked on PHP 5.3 .

I checked session.save.path and that is fine. I even see session files (with the correct user and everything), but they are empty when the sessions do not work, which makes sense. But why does it sometimes work, and sometimes not? I am having trouble with this.

+4
source share
4 answers

Do sessions require disk space to be used so that the server receives disk space to save the session? we had a problem with the Linux kernel, in which sessions were no longer saved because disk space ran out on its disk.

+4
source

check your php.ini, do phpinfo () and see how the sessions are configured ... especially look at the session.gc_maxlifetime parameter.

http://php.net/manual/en/session.configuration.php

+1
source

We also had this problem. We solve it by changing session.auto_start = 0 to session.auto_start = 1 in the php.ini server. I don’t know why, but it solved our problem. We are still investigating why this worked and what are the consequences of this.

0
source

I also have the same problem when one of my dedicated servers on which PHP 5.4.3 is installed.

Ironically, when I clear my browser cache (everything from the beginning).

It works great.

0
source

All Articles