Since HTTP is stateless protocol you haven't such opportunity.
But of course there are some ways to emulate such things.
Here are the brief review for some of them:
* you may check the time of last viewed page for authenticated users
e.g. everyone who visited the site within 5 minutes is online.
* with the same approach you may try to track non-authenticated users
by their IP addresses (but don't forget to take care of all related
stuff in this case, like removing expired visit records from your DB )
* also you may try to add some AJAX script which will pull the server
each 3 minutes from browser, which give you to know that user is
online but just viewing the same page...