Reputation: 20765
I'm wondering if I can destroy/modify sessions in a native PHP way that doesn't involve file I/O directives.
I'm not talking about $_SESSION, I mean access to the session files themselves.
For instance, PHP stores sessions on linux as files:
@lamp:/var/lib/php5$ ls
sess_301dc8935f1775312e9007431782c68b
sess_6892f0bec257e646d193adfd91233c40
sess_966909941003dd6fd333727d8862be6e
sess_cb7c07117cef89674a686ffff8a730f2
sess_ffb4db1d9002741b7e0fcc02090b9aaa
sess_305aeb0fdba7548e389394cb31d77c3b
.... etc
$_SESSION gives us the value of what's inside a current session, and the session_start()
and session_destroy()
will terminate the current session identifier.
I want to know if I can destroy or modify sessions globally in a native way to php that doesn't resort to me having to do fopen(/var/lib/php5/sess_whatever)
, I don't want to work with the current session, I want a script to be able to either delete or modify sessions outside of what $_SESSION
, session_start
, and session_stop
do, as they force you to use the present session.
Upvotes: 0
Views: 224
Reputation: 2856
Sounds to me like you can't have it both ways. Session handling functions are built to interact with the current session. In order to manipulate other sessions you will have to go the whole fopen() route.
Upvotes: 1
Reputation: 655219
session_destroy
does that:
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.
Upvotes: 3