Answer the question
In order to leave comments, you need to log in
How to implement sessions in php to get a list of sessions and their data?
Hello, I'm very interested in the issue of implementing sessions in php in such a way that in the future it would be possible to get the number of all open user sessions on the server and read their data. I have a project - a streaming server, video is being distributed in HLS format (ts segments are given for 5 seconds), and so .. we need to implement statistics, who is watching what "now (in real time)". As I understand it, all sorts of memcache and redis servers disappear? And do you need a database like mysql ? As a result, I need to render a page that will contain an array of all sessions (each user) and its content ..
Answer the question
In order to leave comments, you need to log in
Make your custom sessions.
Get them into the database along with the necessary data.
There it will be possible to search, and sort, and display conveniently. Well, in general, there will be more flexibility, for example, it will be possible to get the number of sessions very quickly and trivially. Well, get rid of some troubles that do not work out of the box in standard sessions (automatic deletion due to obsolescence, cancellation of all user sessions when changing the password, and so on).
PHP out of the box stores all sessions in the server's temporary folder, or you can see where exactly they are
<?php
echo ini_get( 'session.save_path');
?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question