NYCPHP Meetup

NYPHP.org

[nycphp-talk] PHP sessions and displaying who's online

Mitch Pirtle mitchy at spacemonkeylabs.com
Tue Feb 3 13:14:00 EST 2004


yury at heavenspa.com wrote:

> Folks.. is there a simple effective way to do this *without* using mySQL?
> 
> if there is a tutorial/link, i'd appreciate it..
> 
> example: there are 25 visitors online and 3,000,000 visitors since
> yesterday.

If you pointed all of your session tempfiles to the same directory (like 
'/tmp/phpsess' or some such) then I suppose you could parse all the 
files in that directory to get a count.  But I don't know a logical way 
to track the number of sessions and such, unless you wanted to write to 
a text file on the filesystem...

It is definitely easier to use a database (PostgreSQL!), as with a 
decent database (PostgreSQL!) you can generate all the statistics that 
you need.  Yes, the database (PostgreSQL!) is the best route to go.

Did i mention PostgreSQL?

Another question on this topic, is there a best-practice for 
LAMP^D^D^D^D LAPP community websites where you need to track online- and 
recent-logins and such?  I'd love to hear any working knowledge that 
dictates a superior approach...

For example, I'm thinking about a high-traffic website that would use 
pound up front, racks of apaches for httpd, sql relay in front of the 
database groups, and clusters of slaves for reads (and some homegrown 
goofiness for CRUD operations).  Where would you put session data for 
this, and how would you get your 'XXX online, XXX this week' type of 
information?

-- Mitch



More information about the talk mailing list