NYCPHP Meetup

NYPHP.org

[nycphp-talk] "how many users online" PHP solution: sessions or DB?

Nicholas Tang ntang at mail.communityconnect.com
Tue Nov 4 10:18:20 EST 2003


On Tue, 2003-11-04 at 09:50, Chris Shiflett wrote:
>
> Sessions can be stored in a central database, shared among a cluster
> (msession), and things like that.

If they're in a database, then you're using a database already.  And can
you do something as simple as the listed:

    $handle = opendir(session_save_path());
    if ($handle == false) return -1;
 
    while (($file = readdir($handle)) != false) {
        if (ereg("^sess", $file)) $count++;
    }
    closedir($handle);

...if you're using msessions?  Does it store a local file for each
session on each webserver in the cluster?

If not, then you're right in the same boat again.  Regardless, it seems
to make more sense to me to do it yourself in a database, then you have
full control over the parameters of the application and can adjust it as
needed (timeouts, data stored, parameters, whatever).

Nicholas
-- 
Nicholas Tang <ntang at mail.communityconnect.com>
Community Connect Inc. - http://www.communityconnect.com/





More information about the talk mailing list