The behaviour of these functions is affected by settings in php.ini.
|session.gc_divisor||"100"||PHP_INI_ALL||Available since PHP 4.3.2.|
|session.cookie_secure||""||PHP_INI_ALL||Available since PHP 4.0.4.|
|session.cookie_httponly||""||PHP_INI_ALL||Available since PHP 5.2.0.|
|session.use_only_cookies||"1"||PHP_INI_ALL||Available since PHP 4.3.0.|
|session.use_trans_sid||"0"||PHP_INI_ALL||PHP_INI_ALL in PHP <= 4.2.3. PHP_INI_PERDIR in PHP < 5. Available since PHP 4.0.3.|
|session.bug_compat_42||"1"||PHP_INI_ALL||Available since PHP 4.3.0. Removed in PHP 6.0.0.|
|session.bug_compat_warn||"1"||PHP_INI_ALL||Available since PHP 4.3.0. Removed in PHP 6.0.0.|
|session.hash_function||"0"||PHP_INI_ALL||Available since PHP 5.0.0.|
|session.hash_bits_per_character||"4"||PHP_INI_ALL||Available since PHP 5.0.0.|
|url_rewriter.tags||"a=href,area=href,frame=src,form=,fieldset="||PHP_INI_ALL||Available since PHP 4.0.4.|
The session management system supports a number of configuration options which you can place in your php.ini file. We will give a short overview.
There is an optional N argument to this directive that determines the number of directory levels your session files will be spread around in. For example, setting to '5;/tmp' may end up creating a session file and location like /tmp/4/b/1/e/3/sess_4b1e384ad74619bd212e236e52a5a174If . In order to use N you must create all of these directories before use. A small shell script exists in ext/session to do this, it's called mod_files.sh. Also note that if N is used and greater than 0 then automatic garbage collection will not be performed, see a copy of php.ini for further information. Also, if you use N, be sure to surround session.save_path in "quotes" because the separator (;) is also used for comments in php.ini.
If you leave this set to a world-readable directory, such as /tmp (the default), other users on the server may be able to hijack sessions by getting the list of files in that directory.
Note: Prior to PHP 4.3.6, Windows users had to change this variable in order to use PHP's session functions. A valid path must be specified, e.g.: c:/temp.
Note: If different scripts have different values of session.gc_maxlifetime but share the same place for storing the session data then the script with the minimum value will be cleaning the data. In this case, use this directive together with session.save_path.
Note: If you are using the default file-based session handler, your filesystem must keep track of access times (atime). Windows FAT does not so you will have to come up with another way to handle garbage collecting your session if you are stuck with a FAT filesystem or any other filesystem where atime tracking is not available. Since PHP 4.2.3 it has used mtime (modified date) instead of atime. So, you won't have problems with filesystems where atime tracking is not available.
Note: The expiration timestamp is set relative to the server time, which is not necessarily the same as the time in the client's browser.
Note: For PHP 4.1.2 or less, it is enabled by compiling with --enable-trans-sid. From PHP 4.2.0, trans-sid feature is always compiled. URL based session management has additional security risks compared to cookie based session management. Users may send a URL that contains an active session ID to their friends by email or users may save a URL that contains a session ID to their bookmarks and access your site with the same session ID always, for example.
Since PHP 6.0.0 it is also possible to specify any of the algorithms provided by the hash extension (if it is available), like sha512 or whirlpool. A complete list of supported algorithms can be obtained with the hash_algos() function.
Note: This was introduced in PHP 5.
Note: This was introduced in PHP 5.
Note: If you want HTML/XHTML strict conformity, remove the form entry and use the <fieldset> tags around your form fields.
Note: As of PHP 4.0.3, track_vars is always turned on.