Home >Backend Development >PHP Tutorial >Detailed description of setting parameters of session in PHP5 configuration file_PHP tutorial
;Handling session access mode (default: files)
session.save_handler = files
;session file storage path (default: /tmp)
session.save_path = /tmp
;The function of session using cookies (default: start 1)
session.use_cookies = 1
;The name of the session (default: PHPSESSID)
session.name = PHPSESSID
;Auto start (default: off 0, here can be changed to 1)
session.auto_start = 0
;The lifetime of the session cookie, in seconds (preset Set: Disappears when the browser is closed 0)
session.cookie_lifetime = 0
; The path of the session cookie (default: the same as domian or the root path /)
session.cookie_path = /
; The domain name of the session cookie (default: empty)
session.cookie_domain =
; The way to process continuous data, this function is only used internally by the WDDX module or PHP ( Default: php)
session.serialize_handler = php
; Garbage collection at a rate of one thousandth
; The probability of garbage collection (default: 1)
session. gc_probability = 1
; Set the process ratio, (php5 new parameter, default: 1000)
session.gc_divisor = 1000
; The lifetime before (garbage collection) is 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", it still allows you to register global variables. Initialize a SESSION value in the 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
; Check whether the session still exists when reorganizing (default: empty)
session.referer_check =
;Special Set the length of the session value (default: off)
session.entropy_length = 0
; Specially set the 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) Transmission mode (based on security, default: off)
session.use_trans_sid = 0
; Select 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
; Tags for URL redirection
url_rewriter.tags = “a=href, area=href, frame=src, input=src, form=fakeentry”
Remember to restart the Apache server.