php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #17846 Session randomly malfunctions
Submitted: 2002-06-19 14:05 UTC Modified: 2002-08-03 01:00 UTC
Votes:18
Avg. Score:4.7 ± 0.7
Reproduced:17 of 17 (100.0%)
Same Version:7 (41.2%)
Same OS:10 (58.8%)
From: fabian at ahrberg dot se Assigned:
Status: No Feedback Package: Session related
PHP Version: 4.2.1 OS: Linux 2.4 kernel
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2002-06-19 14:05 UTC] fabian at ahrberg dot se
When I run session_start() and let it create the sid in a cookie and store the session data in files the session works just wonderful!

However,
For no reason at all the session just dies. Upon investigating I've noticed that the cookie is still there as it should be, no diffrence from when the session worked, and the same session with its data is still there as a file.
In 99/100 cases the session works as it should and then, way random, the cookie and the data on the server just can't seem to find eachother through the session system.
At first I thought the problem was related to my session storage, I used to store the sessions in mysql, but when I tried to see if it dissapeared with files - it didn't.
I can't reproduce the problem as I find it all random. It can happen anywhere at anytime when surfing the site im working with.
When I send the sid as a part of the url I can't manage to reproduce the problem but maybe it's there as well, even if I don't think so.
Sum:
Sid stored in cookie + session -> works, almost always.

Any ideas?

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-06-19 22:50 UTC] yohgaki@php.net
It could be browser's fault.

I noticed my IE6 sends 2 cookies for the same cookie name, and PHP couldn't initilize session as a result. And this is _very_ rare.

Check what is going on with packet sniffer when it happenned. It may be browser's fault.


 [2002-06-20 08:55 UTC] fabian at ahrberg dot se
The problem occurs with mozilla, ie, lynx, diffrent versions, diffrent plattforms.

It's REALLY annoying since we run a forum and all kinds of functions where our users really hate to be logged out when they've just finshed a long letter, an auction whatever.
 [2002-06-20 16:15 UTC] lance at metaldog dot co dot za
I have a similar problem with IE and a server on a local network. I have 4.2.1 running on a dev system and on a live system on the net. Exactly the same code is running on both systems and they have almost identical setups. On the external system, I can maintain session state everytime without problems... On the internal system my IE browser sometimes and sometimes does not maintain a session. 

Opera or Netscape do not have this problem at all to either system and the session values are being sent properly... With IE, I have noticed that the session id changes on each load of the session_start() so logically it would indicate that its impossible to maintain state if it keeps resetting itself.   

The odd thing is that the same browser works to the external version of the site which is on a much slower link.

This has occured almost every time, but occasionally things will go through for a while and then stop. The problem ONLY happens with IE5.5 and 6 that I can tell.

very very frustrating and odd, because the code is working perfectly on non-Ie browsers and even works sometimes with IE so it is almost impossible to try and trace from a coding perspective
 [2002-06-28 19:39 UTC] fabian at ahrberg dot se
Hmm... I spent a whole day looking into this. The sessioncookie is set to die with the browser, and not time-out. HOWEVER: In 99% of the cases the cookie looked just fine but in a few cases the cookie was set for a limited lifetime even though it shouldn't. So I tried to use the function session_cookie_set (or whatever it's called =) ) in case of something mysterious and guess what? Since I set the lifetime to "0" with this function, just before I call session_start, I haven't experineced the problem and no vistor on the site neither... Hmm... so the question is, why does the session-cookie sometimes show up with a limited lifetime, when it in 99% shows up with what it should (till the browsers closes)... hmm
 [2002-07-02 22:06 UTC] sniper@php.net
Is session.cookie_lifetime = 0 in your php.ini?

 [2002-08-03 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2002-08-20 21:47 UTC] rossr at reactive dot com
I'm exeriencing the same bug, where the session randomly dissappears and the user is logged out of our site. This appears to be happening across different browsers and platforms as previously mentioned.

The site is hosted on the same OS (Linux 2.4 Kernel) but the version of PHP is 4.2.2

The setting for "session.cookie_lifetime" is set to 0 in our php.ini file.
 [2003-07-09 09:18 UTC] wieri420 at planet dot nl
I had the random faillure of sessions too.

Are you using cookies and sessions in one script?
Try commenting all cookie related functions (setcookie etc..) and see if it solves the problem.

It solved the session problem for me.
I'm curious if it solves the problem for others too...
 [2003-12-09 12:35 UTC] simon at infomaniak dot ch
I'm experiencing the same problem too. 

I've noticed that even if it was set to 0 in php.ini, session.cookie_lifetime had random values at session start. 
I'm now trying to force it to 0 using 
<i>ini_set( 'session.cookie_lifetime', 0);</i>
before the first session_start(). It seems to work but I'm not really sure for now, I have to test it more.
 [2009-12-01 02:33 UTC] dimo414 at gmail dot com
I noticed that in my case my webhost (FatCow) wants you to set the 
session_save_path to a special location, I was having this or a similar 
issue and when I found that snippet of (very buried!) documentation, the 
problem seems to now be resolved.

http://members.fatcow.com/knowledgebase/read_article.bml?kbid=600
 
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sun Feb 05 05:05:50 2023 UTC