This is my understanding:
When using file-based sessions, each request literally locks the file until the end of the request.
The value is that the next request (which also uses session data) must wait for the lock to be released.
This is used to prevent corrupted session data.
Using session_write_close() will clear (but not lose session data) and release the lock earlier in the file so that other requests continue.
This is good practice, especially if you have scripts that often sleep.
zaf
source share