views:

221

answers:

4

I restarted apache,but the session doesn't expire!

+6  A: 

why not use session_destroy();?

Stefan Ernst
That, and you could set the time-limit to minus 3600 or something.
WebDevHobo
It will only destroy session of a specific user,but I want to destroy all!
Mask
I want to destroy sessions of all users.
Mask
+4  A: 

Delete all files in the temporary directory defined in php.ini.

thephpdeveloper
I believe deleting the files manually would be a solution if you need to kill all sessions at once. But I hope this is a once-in-forever situation.
Stefan Ernst
this would destroy sessions of all users.
thephpdeveloper
+2  A: 

If you have:

session.save_handler = files

in your php.ini file, which I believe you will by default, then session data will be stored in files. Therefore bouncing the server won't destroy them.

Andy
+1  A: 

What I ussually do when I'm developing, I create a page that unsets and destroys all sessions. So everytime I need to destoy the sessions I run the script. eg. www.example.com/destroySession.php

destroySession.php contains something like (only an example)

session_start();
unset($_SESSION['name']); //If only one session variable is used
session_destroy();
Roland