kylex
kylex

Reputation: 14406

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 button 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?

Upvotes: 0

Views: 1427

Answers (2)

kylex
kylex

Reputation: 14406

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

Upvotes: 1

KeatsKelleher
KeatsKelleher

Reputation: 10191

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

Upvotes: 0

Related Questions