What is the best way to destroy all sessions (not just the one of the current user)?
It depends on how your sessions are being stored. If they're in a database, just delete them. If they're on the file system somewhere like in /tmp, just delete them. For information on sessions in PHP, check out the manual. http://www.php.net/manual/en/book.session.php
Use session_save_path()
to find where your session files are being saved by default, unless you're sending them to a memcached,mysql or such. From terminal or PHP issue the system command. For instance
Shell: rm -rf /var/lib/php/session
PHP: shell_exec('rm -rf '.session_save_path() );
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With