Re: Finding current PHP sessions
| From: | Marek Kilimajer | Date: | Fri, 13 May 2005 09:12:25 +0000 |
| Subject: | Re: Finding current PHP sessions | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-215127@lists.php.net to get a copy of this message | ||
Bogdan Stancescu wrote:
Hello all, I guess this comes up once in a while, does anybody know how I can find the current PHP sessions' IDs? I don't mind if some have passed away, and the PHP gc hasn't run yet, because I'm doing a garbage collection of my own, for data identified by session ID -- it doesn't really matter if I keep a few obsolete files for a while, it only matters that I delete them at some point in the future. I know I could read the session files themselves, but I'd very much rather use a "proper" way to retrieve the active sessions, which would work with alternate methods of storing session data, if there is any such proper way to do this. I read the PHP documentation regarding sessions, and I checked out Google, with no luck. If you guys don't have a solution, it means that there is none -- in other words, you're my last hope, help! :-)Depends on where and how you store your session data. Default file storage simply reads all files in session.save_path (opendir() and readdir()), check if they match the pattern /sess_[0-9a-f]{32}/ and the modification time.