0

How to set the expiration time for session cookie in PHP?
I'm setting the session in index page which can be visited multiple time and the problem is this continuously resets the expiration time which I don't need.

How to use the session_set_cookie_params properly in the index page which is visited multiple times?

www.friend0.in
  • 269
  • 1
  • 2
  • 9
  • 1
    Does this answer your question? [How do I expire a PHP session after 30 minutes?](https://stackoverflow.com/questions/520237/how-do-i-expire-a-php-session-after-30-minutes) – nice_dev Oct 06 '22 at 17:58
  • Try the ini option https://www.php.net/manual/en/session.configuration.php#ini.session.cookie-lifetime You can also try setting from the script using session_set_cookie_params(lifetimeinsecs) https://www.php.net/manual/en/function.session-set-cookie-params.php – Pran Joseph Oct 07 '22 at 04:20
  • @nice_dev Partially it solves the ans, but I hope there is something in built in PHP for the purpose than checking and destroying sessions. – www.friend0.in Oct 07 '22 at 13:29
  • @PranJoseph I don't have access to ini file in shared hosting package. – www.friend0.in Oct 07 '22 at 13:30
  • @www.friend0.in Sure is but you don't have access as you said. – nice_dev Oct 07 '22 at 13:34

0 Answers0