0

My PHP Sessions seem to time out after about 30 minutes to 1 hour. I want to make them last a day.

I've tried the following code to make them last longer:

In my .htaccess file, I added the following lines:

php_value session.gc_maxlifetime 86400
php_value session.cookie_lifetime 86400
php_value session.cache_expire 86400

In my code, I have the following lines:

ini_set('session.gc_maxlifetime', 86400); // Server should keep session data for AT LEAST 86400 seconds

session_set_cookie_params(86400); // Each client should remember their session id for EXACTLY 86400 seconds

session_start(); // Session ready to go!

Even after doing all this, the sessions still expire after 30 minutes - 1 hour. I've looked at several other questions on Stack Overflow about this problem, but none of them have worked for me. Thanks in advance for looking into this, I really appreciate it.

  • 1
    Have you tried deleting all of your cookies, restarting your application server (eg apache, nginx), then testing again? – KayakinKoder Apr 04 '20 at 21:21
  • This might help https://stackoverflow.com/questions/520237/how-do-i-expire-a-php-session-after-30-minutes – some_guy Apr 04 '20 at 21:33

0 Answers0