Mask
Mask

Reputation: 34197

How to clear PHP $_SESSION by apache?

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

Upvotes: 14

Views: 19266

Answers (4)

Stefan Ernst
Stefan Ernst

Reputation: 2781

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

Upvotes: 8

Elitmiar
Elitmiar

Reputation: 36839

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();

Upvotes: 4

Andy
Andy

Reputation: 9048

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.

Upvotes: 5

mauris
mauris

Reputation: 43619

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

Upvotes: 16

Related Questions