get list of all PHP session_id

LukasSvihel picture LukasSvihel · May 13, 2011 · Viewed 7.3k times · Source

Is't possible to get list of all session_id in PHP SESSIONS?

Note: I need maintained some file in the server. One file equal one session. And I need to determine behaviour of old files if SESSION expire.


Thank you all for any advice.

Answer

Aron Rotteveel picture Aron Rotteveel · May 13, 2011

As others have answered, sessions are stored in the path defined by session.save_path in php.ini and you can iterate this directory to retrieve a list of every session.

An alternative approach would be to change the session storage and move it to a database using session_set_save_handler(). You could store all your sessions in a database and do with it whatever you wish.