Home  >  Article  >  Backend Development  >  php session trap

php session trap

z老师
z老师Original
2016-07-30 13:30:261221browse

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)

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn