You are here: Re: PHP Sessions Timing Out. « PHP Programming Language « IT news, forums, messages
Re: PHP Sessions Timing Out.

Posted by John Murtari on 04/06/06 19:21

"Dean Richardson" <advertising@deanrichardson.com> writes:

> I am having problems with my PHP sessions timing out. I have a system
> which requires the user to login. Once they login, it then stores their
> username as a session variable and is checked in each page. If the
> username is missing, then it makes the user log back in.
>
> However, after 5 or 10 mins of not using the system, the user then
> clicks on an option and it is prompting them to login.
>
> At the moment this is only happening on certain computers. I generally
> find that the Windows XP machines dont lose the variables easily, where
> the Windows 2000 machines do.
>
> Could this be a setting in the client or the server?
>
> Any suggestions would help me as I've looked in the php.ini on the
> server and at the IE client settings and nothing strikes me.
>

I assume you know the session is tracked by a cookie,
and the cookie life is set by the server. I'm assuming you have
it set to zero in your php.ini (which means last as long as the
browser).

Sounds like they are expiring at random times and that
is probably a server setting, look at the session.gc_* stuff
below, especially maxlifetime. When that amount of time goes
by it is expired. If you have 'shared hosting' your provider
controls this value. They may have set a very low value to
keep from clogging the session directory with useless stuff.

That should give you a start. If that doesn't do it
you should be able to find the session cookie on most browsers
and actually see what the lifetime was set at.

---------------- PHP.INI
; Lifetime in seconds of cookie or, if 0, until browser is restarted.
session.cookie_lifetime = 0

; Define the probability that the 'garbage collection' process is started
; on every session initialization.
; The probability is calculated by using gc_probability/gc_divisor,
; e.g. 1/100 means there is a 1% chance that the GC process starts
; on each request.

session.gc_probability = 1
session.gc_divisor = 1000

; After this number of seconds, stored data will be seen as 'garbage' and
; cleaned up by the garbage collection process.
session.gc_maxlifetime = 10800

---------------------

Hope this helps.

John
___________________________________________________________________
John Murtari Software Workshop Inc.
jmurtari@following domain 315.635-1968(x-211) "TheBook.Com" (TM)
http://thebook.com/

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация