|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-07-22 10:01 UTC] derick@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 17:00:01 2025 UTC |
Description: ------------ Hello, In short, while a session is in progress, or running, we are not able to remove sess_* files by using unlink(). Yet, when a session is not active, I can remove all the files freely. There is nothing about this in the documentation, and there seems to be this issue all over forums searched from google. I feel this is a bug, as PHP should deny removing files while a session is active. The following produces this error "Warning: unlink(./tmp/sess_2b8185697c7b9d826773403c1477041f) [function.unlink]: Permission denied in X:\path\to\script.php on line 0" <?php define("_PATH_TMP", "X:/dir/to/my/tmp"); ini_set('session.save_path', _PATH_TMP); session_start(); $_SESSION['sid']['obsolete'] = session_id(); session_regenerate_id(); $_SESSION['sid']['replaced'] = session_id(); unlink('./tmp/' . $_SESSION['sid']['obsolete']) print_r($_SESSION); ?> As well, the garbage collection doesnt seem to be working, all I see is my sessions keep piling up since I have my script regenerate an id, thus create a new file in my defined tmp directory. If session_set_cookie_params worked properally, I would beable to define both id's thus to say I could unlink the file with $_COOKIE['sid']['obsolete']. As well, as I read apon session_regenerate_id() its suppose to remove the file apon complition... well, in short, its not!