Header redirect, sessions lost, but only after about 5 minutes
function redirect($url){
header("HTTP/1.1 303 See Other");
header("Location: $url");
exit();
}
I have the function called when certain input buttons are clicked.
The session is set on every page, and it IS passed if the the but开发者_JAVA百科ton is clicked within 5 minutes. But the session is lost after about 5 minutes if the button is clicked.
If I refresh the page (not redirect) the session is not lost, so I'm pretty sure it's not a timeout issue. What could be causing this?
Figured it out. Needed to add this line to my custom php.ini file. For some reason the session needs an explicitly direct session file to save in a local directory.
session.save_path = /path/to/tmp
Try editing this part of your php.ini file and restart apache:
; TTL for user-defined php.ini files (time-to-live) in seconds. Default is 300 seconds (5 minutes)
;user_ini.cache_ttl = 300
精彩评论