I use a $_SESSION variable to store the username and wish to last longer that it does (only for this php script) is there a way?
How to extend the lifetime of $_SESSION?
Collapse
X
-
Tags: None
-
-
-
Yes, if you want this value to remain for any page with session, you have to have this declared.
If you want the entire server (php global setting) just change it in your php.ini like dheerajjoshim suggested vs what Dorm suggested.
Cheers,
DanComment
-
in the php script the in_set("session .gc_maxlifetime ",2000) will go below the session_start() right?Comment
-
Comment
-
not necessarily, it just has to be called before any use of $_SESSION and any output.
personal note: using a class for sessions comes in handy there because the class will invoke session_start() when necessary (tho you still need to watch out for previous output)Comment
-
Got it, I will try first the init_set and then the session start and if I do not have any errors I will leave it this way, thanksComment
Comment