Home > Article > Backend Development > Detailed explanation of SESSION path configuration in PHP5_PHP tutorial
This article will tell you a detailed tutorial on how to configure the session in php.ini in php5, including paths and other related operations. Students who need to know more can refer to it.
Some settings related to session in php.ini will affect the use of session function. Taking the php5 version as an example, let’s take a look at the settings related to session in php.ini.
;Handling session access mode (default: files)
session.save_handler = files
;session file storage path (default: /tmp)
session.save_path = /tmp
;Session’s function of using cookies (Default: Enable 1)
session.use_cookies = 1
;session name (default: PHPSESSID)
session.name = PHPSESSID
;Auto start (default: off 0, can be changed to 1 here)
session.auto_start = 0
;The lifetime of the session cookie, in seconds (default: disappears when the browser is closed 0)
session.cookie_lifetime = 0
;Session uses cookie path (default: same as domian or root path /)
session.cookie_path = /
;Session uses cookie domain name (default: empty)
session.cookie_domain =
;The way to process continuous data, this function is only used within the WDDX module or PHP (default: php)
session.serialize_handler = php
;Garbage collection at a rate of one thousandth
;Probability of garbage collection (default: 1)
session.gc_probability = 1
;Set process ratio, (php5 new parameter, default: 1000)
session.gc_divisor = 1000
;(garbage collection) lifetime before being processed (default: 1440[seconds])
session.gc_maxlifetime = 1440
; There is a BUG in PHP 4.2 and previous versions. Even if you disable "Allow registration of global variables", you can still initialize a SESSION value in the global variable scope
;PHP 4.3 and later versions will issue corresponding warnings, and you can suppress the warnings. In PHP5, the warning will only be displayed if you turn on bug_compat_42 (=ON).
session.bug_compat_42,0
session.bug_compat_warn = 1
;Session checks whether the session still exists when reorganizing (default: empty)
session.referer_check =
;Specially set the length of the session value (default: off)
session.entropy_length = 0
;Specially set session value file
session.entropy_file =
;Use cache limiter (default: no cache)
session.cache_limiter = nocache
;Use cache lifetime
session.cache_expire = 180
;Use sid value (session_id) transfer mode (based on security, default: off)
session.use_trans_sid = 0
;Choose a HASH function, 0 is MD5 (128-bit strength), 1 is SHA-1 (160-bit strength)
session.hash_function = 0
;Define how many bits are stored per character when converting binary hash data into some readable data.
;4 bits: 0-9, a-f
;5 bits: 0-9, a-v
;6 bits: 0-9, a-z, A-Z, “-”, “,”
session.hash_bits_per_character = 5
;URL redirect tag
url_rewriter.tags = “a=href,area=href,frame=src,input=src,form=fakeentry”
After modifying the above settings, you should restart the Apache server to load the above modifications.
Configuring session is actually not difficult as long as everyone takes a good look at it and it will be KO.