Reply to Re: Track user's Online Status

Your name:

Reply:


Posted by Erwin Moller on 02/16/07 14:52

Mitul wrote:

> Thanks Erwin,
>
> Actually I have saved session ID in database. But Actually I am facing
> problem with session expire on Browser close. I have tried a things
> that I am accessing session file store at session store path. If its
> there then we conclude that user is still there and if its not there
> then we can say that user's session is expire and user is no longer
> exist. But there is a problem that this is malfunctioning some time.
>
> Please suggest me.

Hi Mitul,

Have a look at your php.ini.
Find the part about SESSIONS.
Look at the garbagecollection logic/settings.

The fact that you find a sessionfile deos NOT mean that session is still
valid.
I think PHP will (out of the box) only delete old sessionfiles if the
randomnumber generator produces a number smaller than 0.01.
Thus one in a hundred times.

Here is mine (from an old php.ini)
; Percentual probability that the 'garbage collection' process is started
; on every session initialization.
session.gc_probability = 1

If memory serves me well newer versions of PHP have 2 numbers for this, that
are divided.
Better check carefully by yourself what your php.ini says.

Anyway, to make your directoryscan through the sessionstorage more reliable,
you might want to increase this chance to 100%, forcing stale sessions to
be removed every time anybody uses a session. This will of course slow your
application down a little if you have many sessions for PHP to scan each
time, so you better think this through, or better test. :-)

Or you write your own sessionstoragehandlers and use a database for
sessionstorage. I would advise that, but it is more work if you never did
that before. Database based sessionstorage is very fast, AND makes it
really easy for you to see who is online.

Regards,
Erwin Moller


>
> Regards,
> Mitul Patel.

[Back to original 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

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