CentOS 7 PHP7 Enable session extension

Configuration Guide:
http://php.net/manual/zh/refs.basic.session.php
http://php.net/manual/zh/session.configuration.php

Use the command:

php -i

Find the information for the printout session block

session

Session Support => enabled
Registered save handlers => files user 
Registered serializer handlers => php_serialize php php_binary 

Directive => Local Value => Master Value
session.auto_start => Off => Off
session.cache_expire => 180 => 180
session.cache_limiter => nocache => nocache
session.cookie_domain => no value => no value
session.cookie_httponly => Off => Off
session.cookie_lifetime => 0 => 0
session.cookie_path => / => /
session.cookie_secure => Off => Off
session.gc_divisor => 100 => 100
session.gc_maxlifetime => 1440 => 1440
session.gc_probability => 1 => 1
session.lazy_write => On => On
session.name => PHPSESSID => PHPSESSID
session.referer_check => no value => no value
session.save_handler => files => files
session.save_path => no value => no value
session.serialize_handler => php => php
session.sid_bits_per_character => 4 => 4
session.sid_length => 32 => 32
session.upload_progress.cleanup => On => On
session.upload_progress.enabled => On => On
session.upload_progress.freq => 1% => 1%
session.upload_progress.min_freq => 1 => 1
session.upload_progress.name => PHP_SESSION_UPLOAD_PROGRESS => PHP_SESSION_UPLOAD_PROGRESS
session.upload_progress.prefix => upload_progress_ => upload_progress_
session.use_cookies => On => On
session.use_only_cookies => On => On
session.use_strict_mode => Off => Off
session.use_trans_sid => 0 => 0

as well as php.ini Location of configuration

Loaded Configuration File /etc/php.ini

Next, configure to use the session main item

stay php.ini Find the following and configure enable (remove the preceding; sign and configure the corresponding value)

session save location

;session.save_path = "/tmp"

session expiration time

session.gc_probability = 1
session.gc_divisor = 1000
session.gc_maxlifetime = 1440

The three attributes have to be used in combination

Recovery probability: session.gc_probability/session.gc_divisor
In other words, 1 / 1000 is a session, which is recycled once every 1000 times.

As long as you have a large number of visits, it can achieve the effect of recycling.

If you set session.gc_ When divisor = 1, overdue recycling is obvious

session.gc_ The unit of maxlifetime is seconds. The default value is 1440 seconds = 24 minutes

Keywords: Session PHP

Added by harlequeen on Fri, 10 Jul 2020 18:46:58 +0300