Jump to content

session randomly being destroyed


L

Recommended Posts

Hey everybody,

With school I've been quite busy; thus, my absence from the forums. But I am here, on my free time, with a question.

I log in fine, and surf my website, go to other ones, but when I come back I'm logged out. Now I'm thinking I didn't set my session right correctly. I check back and they seem fine.

 

So I log in again, reload my webpage a couple of times, and then I "log out". This means that when I refreshed the login inputs show up. This is bad because I have those show up if a person is not logged in(meaning the sessions aren't set). This means that the sessions are either being destroyed, or aren't being set right.

 

But the last option is that my host is messed up, because I have the same thing running at another host and it works fine.

 

Any thoughts, solutions?

Thank you for your time

~L

Link to comment
https://forums.phpfreaks.com/topic/71022-session-randomly-being-destroyed/
Share on other sites

As you say... 2 possible reasons:

1. Check php.ini to find out length of session, 'cookie_lifetime' should be set to '0' for 'until browser closed'.

2. Do a grep for 'session_destroy', 'session_unregister', 'session_unset', 'session_write_close', ... there are other ways you may change or reset the session, but these are the more probable. Especially the unset, thinking your just getting rid of vars, e.g.

Do NOT unset the whole $_SESSION with unset($_SESSION) as this will disable the registering of session variables through the $_SESSION superglobal.

If you use a host then you'll probably not have access to it. You can view it by making a php page such as:

<?php
echo phpinfo();
?>

Here's some refs for handling from php:

http://uk3.php.net/manual/en/function.phpinfo.php

http://uk3.php.net/manual/en/function.ini-get.php

http://uk3.php.net/manual/en/function.ini-set.php

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.