简体   繁体   中英

removing php session timeout

I'm looking to remove the timeout on php sessions on my site. the result of:

var_dump(ini_get('session.save_path')); var_dump(ini_get('session.gc_maxlifetime')); var_dump(ini_get('session.cookie_lifetime'));

Is string(13) "/var/lib/php5" string(4) "1440" string(1) "0"

According to the forums I've seen, with session.cookie_lifetime set to 0 timeout should already be unlimited shouldn't it?

So two questions: Which values do I need to set to remove session timeout? And also... I understand I need to put code into .htaccess but where does the .htaccess need to be to take effect on php sessions?

I'm not really sure about how PHP session garbage collection works, but I'm not sure that you can completely eliminate it. If you want to retain the session, put some JS on the page that periodically makes requests to keep the session fresh. If your concern is keeping people logged in for even longer than that (perhaps after browser closing) you can use your own cookie .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM