From 71ee784aed3c1697fb6f60eef3eff01467a0df2c Mon Sep 17 00:00:00 2001 From: Adam Harvey Date: Wed, 25 Sep 2013 21:00:54 +0000 Subject: [PATCH] Add a note about how the files session backend locks session files. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@331493 c90b9560-bf6c-de11-be94-00142212c4b1 --- reference/session/examples.xml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/reference/session/examples.xml b/reference/session/examples.xml index 625dde9268..5bebe5283d 100644 --- a/reference/session/examples.xml +++ b/reference/session/examples.xml @@ -88,6 +88,24 @@ unset($_SESSION['count']); register_globals will overwrite variables in the global scope whose names are shared with session variables. Please see Using Register Globals for details. + + + File based sessions (the default in PHP) lock the session file once a + session is opened via session_start or implicitly via + session.auto_start. Once + locked, no other script can access the same session file until it has been + closed by the first script terminating or calling + session_write_close. + + + This is most likely to be an issue on Web sites that use AJAX heavily and + have multiple concurrent requests. The easiest way to deal with it is to + call session_write_close as soon as any required + changes to the session have been made, preferably early in the script. + Alternatively, a different session backend that does support concurrency + could be used. + +