”;
From PHP version 7 onwards, the session_start() function accepts an array of options to override the session configuration directives set in “php.ini”. The [session] session in “php.ini” defines the default values of various options.
The options, if provided, are in the form of an associative array of options that will override the currently set session configuration directives. The keys should not include the “session.” prefix.
Example
For example, you may start the HTTP session with the two session options defined as the parameters of session_start() function −
<?php session_start([ ''cache_limiter'' => ''private'', ''read_and_close'' => true, ]); ?>
Configurable Options of an HTTP Session
Some of the configurable options of an HTTP session in PHP are as follows −
session.name
It specifies the name of the session which is used as cookie name. It should only contain alphanumeric characters. Defaults to PHPSESSID.
session.save_handler
It defines the name of the handler which is used for storing and retrieving data associated with a session. Defaults to files.
session.auto_start
It specifies whether the session module starts a session automatically on request startup. Defaults to 0 (disabled).
session.cookie_lifetime
It specifies the lifetime of the cookie in seconds which is sent to the browser. The value 0 means “until the browser is closed.” Defaults to 0.
session.cache_limiter
It specifies the cache control method used for session pages. It may be one of the following values: nocache, private, private_no_expire, or public. Defaults to nocache.
session.sid_length
It allows you to specify the length of session ID string. Session ID length can be between 22 to 256. The default is 32.
session.upload_progress.enabled
It enables upload progress tracking, populating the $_SESSION variable. Defaults to 1, enabled.
session.lazy_write
When it is set to 1, it means that the session data is only rewritten if it changes. Defaults to 1, enabled.
”;