How to Count the number of active user in a website without using database or saving number in file using PHP
How to Count the number of active user in a website without using databa开发者_Go百科se or saving number in file using PHP.
ex. you and i are login/using a website how can i know that there are 2 active users in the wbsite?
Does anyone know a function/method for this?
If the case for 'active users' is a login and session, and you have coded your site such that only logged in users get a session, you could get a rough estimate of 'active users' by counting the number of files in the php session directory. For example, assuming your session is set to /var/lib/php/session
you could run something like this periodically.
ls -l /var/lib/php/session | wc -l
精彩评论