FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


extremely short SESSION lifetime





JayBee
Create session (first line of PHP script)
Code:
session_start();


I read session data like this
Code:
$this->name = $_SESSION["sess_name"];


I write session data like this
Code:
$_SESSION["sess_name"] = $this->name;


and I destroy session, when the user log-out like this
Code:
session_destroy();
$_SESSION = array();


What am I dooing wrong?
With Frihost, I have many problems with sessions. The session lifetime is too short (about one minute).
What could I improve, or what global variables (that I perhaps rewrite) modifies session params?
kv
I don't think there is any thing wrong with your code, but you might have placed some code in wrong place. For example, you might have accidently put

Code:
session_destroy();
 

or
Code:
$_SESSION = array();


somewhere in one of your php file, visiting which might be terminating your session.

I am using the php session on frihost since I got hosting here and I haven't faced any problem till now.
x-stream
But Ive got the same Problem! Wait a second, Ill read out the
session.gc_maxlifetime...
x-stream
Ive got it:
try putting
Code:
ini_set('session.gc_maxlifetime',3600);

at the beginning of your script, it works!
(for 3600, type the seconds your session should be alive)
x-stream
Hm, Its not really the solution... it worked once....
So now I read out the lifetime with
Code:
echo (ini_get('session.gc_maxlifetime'))

, and php said 1440. But the time till the session dies is NEVER 24 mins!!
snowboardalliance
Double check that you didn't mess with the session like they said. Or maybe make a dummy page with simple session tests to see if it lasts 24 minutes.
Ducksteina
Sessions are working for me without any problem.
I think your code has got an error. Post it so we can look for it.
JayBee
I cant post my code, its so huge. Sad
thank you, I will recack the code. When I solve the problem, I will post the sollution.

BTW, does anyone know, how to "switch off" registrglobals on frihost?
snowboardalliance
JayBee wrote:
I cant post my code, its so huge. Sad
thank you, I will recack the code. When I solve the problem, I will post the sollution.

BTW, does anyone know, how to "switch off" registrglobals on frihost?


Sort of lame they are on but

Quote:
register_globals boolean

Whether or not to register the EGPCS (Environment, GET, POST, Cookie, Server) variables as global variables.

As of PHP 4.2.0, this directive defaults to off.

Please read the security chapter on Using register_globals for related information.

Please note that register_globals cannot be set at runtime (ini_set()). Although, you can use .htaccess if your host allows it as described above. An example .htaccess entry: php_flag register_globals off.

Note: register_globals is affected by the variables_order directive.

from php.net, so you can use .htaccess maybe?
JayBee
snowboardalliance wrote:
... from php.net, so you can use .htaccess maybe?


Thank you
I thing, that partly solve my problems
Georgeboy
I know this subject is not recently started, but I had the same problem. I searched a lot about it and finally it seems to be a very stupid fault...

Not everything in PHP seems to be case-sensitive, but working with sessions is case-sensitive. So, if you want to start a session, use: SESSION_START();. If you want to stop a session, use: SESSION_DESTROY();.

I hope this will help a lot of people handling with the same session problem.

Greetz
Agent ME
That would be odd and I'm sure I've seen working code with it in lower case, and the topic creator's code wouldn't work at all if what you're saying was right.
Related topics
Eiffel's Anime Art!
Which is better, DS or PSP?
.htaccess problem
climate change - hot topic (excuse the punn)
Meatwad's Blog
Star Wars Republic Commando
Weapons for fighting off an alien attack
What is Winter like were you live?
An interesting research
What music you have made?
Why Americans "Aren't" Stupid
Short session games for 50+yrs old?
Symphonism. My religion-in-progress.
Should Frihost offer very short domain extensions?
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.