NYCPHP Meetup

NYPHP.org

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

Daniel Kushner nyphp at websapp.com
Tue Nov 4 10:33:16 EST 2003


Phil,

You would still need a unique identifier (session ID) to identify the users.
Session data whether stored on the file system, database, RAM, etc. is still
session data regardless the storage medium.

--Daniel

> -----Original Message-----
> From: talk-bounces at lists.nyphp.org
> [mailto:talk-bounces at lists.nyphp.org]On Behalf Of soazine at pop.erols.com
> Sent: Tuesday, November 04, 2003 10:26 AM
> To: talk at lists.nyphp.org
> Subject: Re: [nycphp-talk] how many users online PHP solution: sessions
> or DB?
>
>
> 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/ .
>
>
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
>





More information about the talk mailing list