greetings

i have a question regarding a session files that php generates whenever session_start() is invoked....

how can i determine the name of the file that is used by a user's session? i was thinking this...

<?php

$sid = session_id();
$sessionfile = session_save_path() . "sess_" . $sid;

?>

is this right? if not plz provide me with some answers, thanks in advance

:p 😕

    Thank you for a quick response Weedpacket,

    i have one more question to ask.... how are session files deleted? are they destroyed by session_destroy() or does php manage it in different way?

    thank you 😕

      That's the role of the garbage collector. When a PHP script runs, PHP also looks through the session data directory for session files that haven't been modified in a long time (indicating that the client has ended the session at their end). These garbage files are deleted.

      It would be excessively inefficient to do this on every script invocation, however, so (by default) it's only done 1% of the time at random.

      session_destroy() will also delete the session data file.

        Write a Reply...