Jump to content

Cannot get session to stay alive


br3nn4n

Recommended Posts

I can't for the life of me get my script to keep the session alive. It is a problem because it's an article review app in which people spend some time on one page and then click save to okay the article.

 

Well in order to use the review section you must be logged in. Often when a reviewer will click save they will be prompted to re-login.

 

I have a session_start at the beginning of every page requiring  that a user be logged in. It will randomly just delete the session. Any tips? I can post code later, I'm on my phone right now.

Link to comment
https://forums.phpfreaks.com/topic/133974-cannot-get-session-to-stay-alive/
Share on other sites

Session garbage collection will run and delete session data files that have been inactive longer than the session.gc_maxlifetime setting.

 

There are two ways to make the session last longer, set session.gc_maxlifetime longer or use AJAX to periodically send http requests to a page on your server that does a session_start() to refresh that visitor's last access time on the session data file.

 

On a shared server, in addition to setting session.gc_maxlifetime to a larger value, you will need to set session.save_path to be to a folder that is within your account's disk space. This will allow your session.gc_maxlifetime to affect only your session data files.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.