Jump to content

Session Timing out too soon.


exally

Recommended Posts

Hey guys,

 

I can't seem to get my PHP sessions to stay alive longer than 5 mins of inactivity.

 

I have set

 

session.gc_maxlifetime 86400

session.cookie_lifetime 86400

session.name FILEITHERE (i do this as a test, still doens't work).

 

Any ideas ??

Link to comment
Share on other sites

This will have to be incldue on every page.

<?php
ini_set('session.gc_maxlifetime',86400);
ini_set('session.cookie_lifetime',86400);
session_name('FILEITHERE);
?>

unfortunately my server has disabled this method, however i have put this in my .htaccess file and appears correctly when i do phpinfo() and each page where i call session_start()

Link to comment
Share on other sites

If you are on a shared web server, the shortest session.gc_maxlifetime of all the scripts running on the server wins.

 

To get your session.gc_maxlifetime setting to apply only to your session data files, you must set session.save_path to be to a private folder within your account's folder tree so that your session data files are stored separately.

Link to comment
Share on other sites

If you are on a shared web server, the shortest session.gc_maxlifetime of all the scripts running on the server wins.

 

To get your session.gc_maxlifetime setting to apply only to your session data files, you must set session.save_path to be to a private folder within your account's folder tree so that your session data files are stored separately.

in order to be sure, I assume that the files are stored in /tmp - would it be better to create /tmp/custom or /tmp2

 

Also do i have to create the folder and set certain permissions or would PHP handle that?

Link to comment
Share on other sites

If you are on a shared web server, the shortest session.gc_maxlifetime of all the scripts running on the server wins.

 

To get your session.gc_maxlifetime setting to apply only to your session data files, you must set session.save_path to be to a private folder within your account's folder tree so that your session data files are stored separately.

 

thanks, testing this now! It does make sense as we are sharing the server but not the document root if you get me.

we are home2 where i assume there is a home

Link to comment
Share on other sites

You need to apply the proper setting to the folder yourself, which should be some thing along the lines of no public access and only read, write, executable by the scripts. The folder should ideally be hidden from the web, and thus only accessable by the scripts and you as the ftp admin.

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.