How to keep session alive for 1week without logout PHP, overwriting default server values?
I need to do this in the PHP code.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can set the session lifetime in your script by using the session_set_cookie_params -function call before the session is started. The first argument of the function call defines the session lifetime in seconds relative to the server time (so make sure the server clock is correct):
For example, to make a session last a week:
This will override the setting in the php.ini -file.
Make sure to check up on the function documentation on the PHP -site: http://www.php.net/manual/en/function.session-set-cookie-params.php