Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to clear PHP $_SESSION by apache?

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

like image 200
Mask Avatar asked Oct 22 '09 08:10

Mask


People also ask

How do I empty a PHP session?

Destroying a PHP Session A PHP session can be destroyed by session_destroy() function. This function does not need any argument and a single call can destroy all the session variables. If you want to destroy a single session variable then you can use unset() function to unset a session variable.

How do I remove session data?

Removing a specific value from a session is as simple as using the function unset(), just as you would for any other variable.

How do I manually delete a session?

Description ¶ session_destroy() destroys all of the data associated with the current session. It does not unset any of the global variables associated with the session, or unset the session cookie. To use the session variables again, session_start() has to be called.


3 Answers

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

like image 168
mauris Avatar answered Oct 18 '22 21:10

mauris


Why not use session_destroy() to destroy the client's session?

like image 8
Stefan Ernst Avatar answered Oct 18 '22 21:10

Stefan Ernst


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.

like image 5
Andy Avatar answered Oct 18 '22 22:10

Andy