Session Sub Directories

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
icesolid
Forum Regular
Posts: 502
Joined: Mon May 06, 2002 9:36 pm
Location: Buffalo, NY

Session Sub Directories

Post by icesolid »

I have a script that users type a report in and it stores the report in a database. The users log in and I use sessions to accomplish this. My problem is the time it takes the users to fill out the report. Some users take almost 30 minutes to fill it out, and this is something we need to allow our users to do. The users get timed out EVERY time.

I was unable to find any type of code on PHP.net that showed me how to set sessions timeout time, so I asked around and I heard that there is a way to configure "sub directories" with sessions.

My question is how to do this and is it safe, opinions please!
Last edited by icesolid on Wed Aug 16, 2006 3:37 pm, edited 2 times in total.
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

what exactly is the problem? it's timing out?
icesolid
Forum Regular
Posts: 502
Joined: Mon May 06, 2002 9:36 pm
Location: Buffalo, NY

Yes

Post by icesolid »

Yes it is.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

http://php.net/ref.session#ini.session.save-path

I don't see what having subdirectories for session would accomplish for your particular problem.
icesolid
Forum Regular
Posts: 502
Joined: Mon May 06, 2002 9:36 pm
Location: Buffalo, NY

Is It Safe

Post by icesolid »

Is using save_path safe?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Re: Is It Safe

Post by feyd »

icesolid wrote:Is using save_path safe?
Safe... how do you define safe?
icesolid
Forum Regular
Posts: 502
Joined: Mon May 06, 2002 9:36 pm
Location: Buffalo, NY

Post by icesolid »

If i use save_path how will that keep my users logged in longer? or for how long? is there a way of setting the time they can be logged in for?
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

icesolid wrote:If i use save_path how will that keep my users logged in longer? or for how long? is there a way of setting the time they can be logged in for?
that's why I was confused as to why you wanted to know about subdirectory storage when talking of premature session expiration.

I think the first thing to do is determine what lifespan PHP has set for the sessions, both the cookies and the session files via garbage collection. If the length they show is considerably longer than the times you're seeing kill the session, it's time to talk to the host. If they are unwilling to alter the timeframe between temporary directory cleanings, consider setting your session save_path to a directory not in the temporary paths of the server. If the host doesn't allow that, consider database sessions.

... or just cut out everything and move to database sessions. :)
Post Reply