Home  >  Article  >  Backend Development  >  An in-depth introduction to the main session configuration in PHP.ini

An in-depth introduction to the main session configuration in PHP.ini

零到壹度
零到壹度Original
2018-04-11 16:33:303112browse

An in-depth introduction to the main session configuration in PHP.ini

The content of this article is to share with you an in-depth introduction to the main session configuration in PHP.ini. It has certain reference value. Friends in need can refer to it

1.session.save_path

This configuration generally refers to the directory where session files are saved. Since I am using the PHPstudy integrated environment, the directory is as shown below.

An in-depth introduction to the main session configuration in PHP.ini

2.session.save_handler

The function of this configuration item is how to save the session value. The default value is session.save_handler = “files” refers to saving the session value in the form of a file. At the same time, you can also modify the saving method. For example, using “user” refers to the user-defined session storage method.

3.session.name

This configuration item refers to the name of session.name saved in a cookie on the client. Since I am an Apache server, the default is session.name="PHPSESSID";

4.session.use_cookies

This configuration item means whether to use cookies on the client to obtain sessionid , the default is session.usecookies=1, which is saved by cookies.

5.session.auto_start

This configuration item means whether to automatically open the session. The default value is session.auto_stat=0, which is not enabled by default.

6.session.gc_maxlifetime

This configuration item means the life cycle of the session file. The default is session.gc_maxlifetime="1440" , the default is 24 minutes, but it does not mean that the session file will be deleted after 24 minutes. A detailed explanation will be given later.

7.session.gc_probability and session.gc_pisor

These two configuration items should be viewed together. The default value is session .gc_probability = 1 and session.gc_pisor = 1000, The meaning of these two configuration items is that after the session file expires, every time someone visits the website again, the probability of the session file being deleted is 1/1000, so it is obvious session.gc_pisor represents the denominator, session.gc_probability represents the numerator.

Summary: The above are almost the commonly used session configuration items in PHP.ini. In addition, it is not difficult to find that the naming of session configuration items is very standardized. If it is two words, it is basically The above is session.xxxxxx. If it is three words, it is basically session.xxxx_xxxxx. In fact, we will find that all configuration items in php.ini are named like this. Knowing this will help us remember these commonly used configuration items.

Related recommendations:

Session configuration

session storage method and configuration

Detailed explanation of express-session configuration items in node.js

php Chinese website learning topic: php session (including pictures, text, Video, case)

The above is the detailed content of An in-depth introduction to the main session configuration in PHP.ini. For more information, please follow other related articles on the PHP Chinese website!

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