Home php PHP session duration

PHP session duration

Author

Date

Category

Hello.

In PHP file I use session_start (); , I do not use cookies.
I’m trying to extend the lifetime of the session. Naturally, the hosting file php.ini is not allowed to edit and advise all settings to specify in .htaccess there I specified a string equal to three o’clock php_value session.gc_maxlifetime 10800
But the session is still breaking before. Maybe something else needs to register?


Answer 1, Authority 100%

In addition to setting the session.gc_maxlifetime and session.cookie_lifetime settings, you must take another subtlety. http://kocherov.net/nyuansyi-rabotyi-php-session-gc_maxlifetime/

If the session files fall into a shared folder where PHP scripts are running with different settings, then the most minimal settings will be performed. In this case, you need to store session files in a separate folder for this site.

ini_set ('session.save_path', value)


Answer 2, Authority 67%

Try adding at the beginning of scripts:

session_set_cookie_params (86400);
ini_set ('session.gc_maxlifetime', 86400);

and verify that when calling phpinfo changed.

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions