Jump to content

[SOLVED] Sessions timing out after about 5 minutes.


envexlabs

Recommended Posts

Hey,

 

I use sessions to deal with user logins but if the user chooses not to be remembered the session times out quickly.

 

This is what it says under sessions in phpinfo

 

session.cache_expire 180 180

session.gc_maxlifetime 1440 1440

 

The maxlifetime is set to 24 minutes, so i'm not really sure why they are releasing so soon.

 

Anyone have any other ideas?

 

Should i just increase these values?

 

Thanks,

 

envex

Link to comment
Share on other sites

session.cache_expire has absolutely nothing to do with how long a session lasts.

 

A session will exist as long as the browser provides a session id and the corresponding session data file exists on the server.

 

Are you on a shared web server and what does a phpinfo() statement show for your session.save_path?

Link to comment
Share on other sites

session.cache_expire has absolutely nothing to do with how long a session lasts.

 

A session will exist as long as the browser provides a session id and the corresponding session data file exists on the server.

 

Are you on a shared web server and what does a phpinfo() statement show for your session.save_path?

 

Hey,

 

We are on MediaTemple (gs) which is a shared server.

 

session.save_path: no value

 

Am i going to have to set a folder and path for the sessions to be saved?

 

Thanks for the help!

Link to comment
Share on other sites

The server is using the default tmp folder for all the session data files. The shortest session.gc_maxlifetime of all the scripts running on the server wins and some fool has probably set his to 5 minutes in a misguided attempt to control logout using session garbage collection.

 

You need to set the session.save_path setting (before every session start, ideally in a .htaccess file or a local php.ini) to be to a private folder within your account's folder tree. The preferred location is a folder outside your document root folder. If that option is not available and you must put the folder inside your document root folder, you should also put a .htaccess file in it that prevents all http/https access to the files.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.