Well, we host our own so what I was thinking wouldn't quite work for your
situation.  However, I've seen a method that I think would work pretty well
for you.  Basically, you store all the data you want to be persistant
between requests in a database.  You could use the session id you get from
the browser as the key for a sessions table.  So, getting session data looks
something like this:

$sess_id = session_id();
$result = SELECT * FROM sessions WHERE session_id = '$sess_id'

Since session_id() gets it's information from the HTTP request, and the
browser keeps the session cookie (at least it does in our case), you don't
rely on the stuff in the tmp directory at all.

You could also emulate PHP's session-in-file approach using a similar
method.

"Tony Crockford" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> On Fri, 19 Dec 2003 13:37:06 -0800, Anthony Kaufman  wrote:
>
> > PHP Version 4.2.2
> > Apache 2
> > RH 9
> >
> > The problem is that session files in the /tmp directory are completely
> > cleared out at "random" intervals of time.  We assume that the
> > randomness is
> > due to our session.gc_probability setting of "1" causing it to run for
> > 1% of
> > new sessions.  What we don't understand is why the garbage collector is
> > removing valid sessions.  session.gc_maxlifetime is set to 86400 (24
> > hours)
> > so it should keep them around for a good long time.  However, it seems
> > that
> > ALL session files are deleted when the garbage collector runs.  In some
> > cases session files were deleted for sessions that had been around for
> > less
> > than a minute.  We've thought of several hacks that would control the
> > problem but we can't come up with any way to fix it.
>
> I'd be interested to hear of the hacks..
>
> I've got a hosted application that has started losing session state since
> they upgraded PHP and they're blaming me and I know it isn't because I
> have the same spec locally and the same script on different servers.
>
> is there something I can add to my script or in an htaccess file to keep
> my sessions away from their garbage collection, as it seems likely that I
> have a similar situation to you.
>
> TIA
>
> Tony

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to