Home >Backend Development >PHP Tutorial >php session trap
1. Two processes cannot open a session storage handle at the same time. For example, two processes cannot perform session_start() on a session id at the same time, otherwise there is a risk of deadlock.
2. Regardless of whether there is data in the session, calling session_start() will open a storage handle, such as opening a file or establishing a connection. So don’t call session_start()
unless necessary.
3. For the storage types of memcached and redis, there is no connection pool support between requests, that is, a new connection will be created for each request.
4. The generation of session id depends on the global variable $_SERVER['REMOTE_ADDR']
and the current microseconds. If the server calling session_start() or session_id() is not directly facing users, you need to pay attention to whether REMOTE_ADDR
correct.
Related topic recommendations: php session (including pictures, texts, videos, cases)