PHP sessions are blocking, ignoring session_write_close -
I am trying to serve twice simultaneously with the same browser session.
Consider the following minimum example:
& lt ;? Php session_start (); $ SessionId = session_id (); Session_write_close (); $ File = sys_get_temp_dir () '/ Lock_test'; If (! File_exists ($ file)) {touch ($ file); Sleep (5); Unlink ($ file); Echoed! '$ SessionId; } And {echo 'lock! '$ SessionId; } The second request should be in "lock" output, but it always waits for the first request to complete and then outputs "made".
Xdebug is not running PHP version 5.5.
Edit:
Voting to stop it as a duplicate Link to the linked question shows that to solve this problem, attach a random variable. Therefore, I suggest linking the request time and setting it into a timestamp with microseconds.
This behavior is fine. If both requests share the same session and you're using files to store session data, then PHP requires flock () , being corrupted by multiple files To stop, the file will try to write the request. (Of course, PHP is always the herd () session file, but you can see more than one requests that share the same session in effect)
Comments
Post a Comment