PHP sessions dying in a few seconds

Posted by beauchette on Stack Overflow See other posts from Stack Overflow or by beauchette
Published on 2012-09-25T14:55:02Z Indexed on 2012/09/25 15:37 UTC
Read the original article Hit count: 218

Filed under:
|

I have a problem with my server : my sessions are dying on their own after a few seconds. here are two page examples : page1.php :

<?
session_start();
$_SESSION['x'] = 'moo';
?>

page2.php :

<?
session_start();
echo $_SESSION['x'];
?>

php's settings are debian's untouched : no auto start, 1440 seconds maxlifetime, etc

so, if I visit page1.php et then page2.php I'm supposed to see 'moo' for 24 minutes, in my case, you have 'moo' for about 5 seconds. Then I observed that the actual session file, was 44 bytes long, and then 0 a few seconds later, without any other intervention than a few 'ls' to observe the phenomenon, I really have no clue as to what happens and any help would be appreciated.

EDIT: after some fiddling (mainly not doing much besides restarting my server 3 or 4 times) I was able to have my quick example working. and then I noticed that sessions in my session.save_path directory are all 44 bytes except for some that are 0 bytes, so it's like it's working but not always. which is even more frustrating.

© Stack Overflow or respective owner

Related posts about php

Related posts about session