NYCPHP Meetup

NYPHP.org

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

soazine at pop.erols.com soazine at pop.erols.com
Tue Nov 4 10:26:17 EST 2003


This sounds like a good solution, but I don't understand why you would
store a session cluster in a central database, in fact, why store sessions
at all if you have a database in the first place? According to the initial
information I received and researched on it, the DB solution doesn't
involve sessions at all; it involves storing the user's IP address instead
along with a session-like timestamp column; you compare the entered
timestamp field with the current time to compare whether the user is still
"in session" (simulated session you could say).

Phil

Original Message:
-----------------
From: Nicholas Tang ntang at mail.communityconnect.com
Date: 04 Nov 2003 10:12:56 -0500
To: talk at lists.nyphp.org
Subject: Re: [nycphp-talk] "how many users online" PHP solution: sessions or
DB?


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/


_______________________________________________
talk mailing list
talk at lists.nyphp.org
http://lists.nyphp.org/mailman/listinfo/talk

--------------------------------------------------------------------
mail2web - Check your email from the web at
http://mail2web.com/ .





More information about the talk mailing list