Re: Sessions - Informed Opinions

From: Date: Tue, 30 Jul 2002 10:52:25 +0000
Subject: Re: Sessions - Informed Opinions
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-110338@lists.php.net to get a copy of this message
> > > 3 How can I get a count of currently active (I.e non expired) > sessions? > > > > Count the number of session files. > Can I be sure that the count will only include active sessions though? By definition, if the session file is there, it is an active session. There is no such thing as counting active users on the Web. You define a time window and count how many users accessed your site within that window. Once a session has been idle for a time > than the configured session gc time, it will get deleted. I tend to do this out of band though. PHP has a mechanism for calling the session gc code, but I prefer to turn this off and run my own cron job that does this regularly. And yes, this is easier to manage if you have a database where you can do a simple count() query to get the number of active sessions. -Rasmus

« previous php.general (#110338) next »