Re: Total Server Sessions

From: Date: Mon, 03 Jan 2005 17:14:53 +0000
Subject: Re: Total Server Sessions
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-205539@lists.php.net to get a copy of this message
Greg Donald wrote: > On Mon, 3 Jan 2005 23:02:19 +1100, HarryG <harry1980@gmail.com> wrote: >> Is there an easier way to count the total number of sessions running on >> a >> PHP webserver? something like session_count(); >> >> I've seen some php site where it tells you how many people are currently >> online, which I guess is being done by keeping a count of total sessions >> running on the server > > It's a piece of cake if you use database driven PHP sessions. > > http://destiney.com/pub/Destiney_db_sessions_0.1.0.tar.bz2 > > Once you get your PHP sessions running inside a database counting the > sessions is just a select count(*) from sessions query. You can even > force garbage collection before the count to get a realtime count. It would probably be more realistic to add some kind of 'where' clause which counts only people active in the last N seconds/minutes, for MOST sessions. It all depends on your application's needs, of course, but most applications probably have sessions that live a fairly long time for the convenience of the user who walks away and comes back after not TOO long a time, but that person can not realistically be reported as "on-line" if you want an idea of how "active" the application is. I've seen several "chat" applications where I got sucked in to using them because there were people there -- only there really weren't any people there, and it was dead, dead, dead. Don't do that. -- Like Music? http://l-i-e.com/artists.htm

« previous php.general (#205539) next »