note 107805 added to function.session-set-save-handler
| From: | RustyX | Date: | Tue, 06 Mar 2012 21:39:09 +0000 |
| Subject: | note 107805 added to function.session-set-save-handler | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-186512@lists.php.net to get a copy of this message | ||
It is important to understand that PHP's default file-based session handling LOCKS the session
file, inherently allowing ONLY ONE thread handling any given session at a time.
When you implement a DB-backed session storage and you do not do any locking, you may run into
situations where more than one thread is serving the same session, and you may LOSE DATA because the
second thread will overwrite any session changes done by the first thread.
You should therefore think about locking the session somehow if you want to have the exact same
behavior as with the default file-based implementation. For example, with InnoDB you could do a
SELECT ... FOR UPDATE, or you can use the GET_LOCK() function.
----
Server IP: 69.147.83.197
Probable Submitter: 80.57.14.171
----
Manual Page -- http://www.php.net/manual/en/function.session-set-save-handler.php
Edit -- https://master.php.net/note/edit/107805
Del: integrated -- https://master.php.net/note/delete/107805/integrated
Del: useless -- https://master.php.net/note/delete/107805/useless
Del: bad code -- https://master.php.net/note/delete/107805/bad+code
Del: spam -- https://master.php.net/note/delete/107805/spam
Del: non-english -- https://master.php.net/note/delete/107805/non-english
Del: in docs -- https://master.php.net/note/delete/107805/in+docs
Del: other reasons-- https://master.php.net/note/delete/107805
Reject -- https://master.php.net/note/reject/107805
Search -- https://master.php.net/manage/user-notes.php