Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

Lolu chungechunge lwabekwa kunqolobane. Uyacelwa ubuze umbuzo omusha uma udinga usizo.

FF loses $_SESSION data

  • 4 uphendule
  • 2 zinale nkinga
  • 12 views
  • Igcine ukuphendulwa ngu docjojo

more options

Hello, I set an session variable in my index.php, say

session_start(); $_SESSION['test']='hello';

I call another skript on the server via AJAX that includes something like:

session_start(); echo ($_SESSION['test']);

This will result in the output of "hello" for some time.

I have a timer running to call the AJAX function every 20secs and sometimes after a few minutes, sometimes after a few hours, FF loses the session variable.

In other words, $_SESSION['test'] is not set anymore. I can echo session_id(); and verify, that the session is still runing, so does the session cookie, but the complete $_SESSION array is lost.

Any ideas?

Regards, Chris.

Hello, I set an session variable in my index.php, say session_start(); $_SESSION['test']='hello'; I call another skript on the server via AJAX that includes something like: session_start(); echo ($_SESSION['test']); This will result in the output of "hello" for some time. I have a timer running to call the AJAX function every 20secs and sometimes after a few minutes, sometimes after a few hours, FF loses the session variable. In other words, $_SESSION['test'] is not set anymore. I can echo session_id(); and verify, that the session is still runing, so does the session cookie, but the complete $_SESSION array is lost. Any ideas? Regards, Chris.

All Replies (4)

more options

It is my understanding that the browser's role is limited to sending the cookie. If the associated session gets messed up, that sounds like a server/PHP problem...

Do your logs show any unexpected requests for another script that could possibly affect $_SESSION['test']?

Edit: just noticed this post is a week old! This forum focuses on end-user support. You can find more web development help on the mozillaZine Web Development board. Separate forum, separate registration.

Okulungisiwe ngu jscher2000 - Support Volunteer

more options

Hello jscher2000,

no, it looks like it get's lost out of the blue, but my service provider is working on it.

However, as this only happens with FF, I wasn't sure whether it is a server problem. IE, Safari and even FF under Windwows work just fine. It only happens with FF on my mac machine - could that be related to ADD ONs such as Firebug/FirePHP?

Regards, Chris.

more options

Does any of your code call session_unset() or session_destroy()? Either could clear the variables without invalidating the session itself. Otherwise, I don't see how the session id could remain the same. Admittedly I don't have a lot of experience with PHP.

In case caching is an issue, do you ensure you are bypassing the cache in your AJAX call by adding a parameter such as the current time?

more options

Hi jscher2000,

no, not within the script that is repeatedly called. And the first couple of times it works just fine. Only after I a while the session get's lost.

The current script does not have a parameter like that, but when I tried to find the error I also tried it with an iframe and also with the .src of an image - so not with AJAX, and I used a randam parameter to make sure it is not loaded from cache - still with the same result ...

Regards, Chris.