Na działanie tych funkcji wpływają ustawienia zawarte w pliku php.ini.
Nazwa | Domyślnie | Możliwość zmian | Rejestr zmian |
---|---|---|---|
session.save_path | "" | PHP_INI_ALL | |
session.name | "PHPSESSID" | PHP_INI_ALL | |
session.save_handler | "files" | PHP_INI_ALL | |
session.auto_start | "0" | PHP_INI_ALL | |
session.gc_probability | "1" | PHP_INI_ALL | |
session.gc_divisor | "100" | PHP_INI_ALL | Available since PHP 4.3.2. |
session.gc_maxlifetime | "1440" | PHP_INI_ALL | |
session.serialize_handler | "php" | PHP_INI_ALL | |
session.cookie_lifetime | "0" | PHP_INI_ALL | |
session.cookie_path | "/" | PHP_INI_ALL | |
session.cookie_domain | "" | PHP_INI_ALL | |
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_cookies | "1" | PHP_INI_ALL | |
session.use_only_cookies | "1" | PHP_INI_ALL | Available since PHP 4.3.0. |
session.referer_check | "" | PHP_INI_ALL | |
session.entropy_file | "" | PHP_INI_ALL | |
session.entropy_length | "0" | PHP_INI_ALL | |
session.cache_limiter | "nocache" | PHP_INI_ALL | |
session.cache_expire | "180" | PHP_INI_ALL | |
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 5.4.0. |
session.bug_compat_warn | "1" | PHP_INI_ALL | Available since PHP 4.3.0. Removed in PHP 5.4.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. |
session.upload_progress.enabled | "1" | PHP_INI_PERDIR | Available since PHP 5.4.0. |
session.upload_progress.cleanup | "1" | PHP_INI_PERDIR | Available since PHP 5.4.0. |
session.upload_progress.prefix | "upload_progress_" | PHP_INI_PERDIR | Available since PHP 5.4.0. |
session.upload_progress.name | "PHP_SESSION_UPLOAD_PROGRESS" | PHP_INI_PERDIR | Available since PHP 5.4.0. |
session.upload_progress.freq | "1%" | PHP_INI_PERDIR | Available since PHP 5.4.0. |
session.upload_progress.min_freq | "1" | PHP_INI_PERDIR | Available since PHP 5.4.0. |
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.
session.save_handler
string
session.save_path
string
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, with a Windows version called mod_files.bat. 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.
Informacja: 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.
session.name
string
session.auto_start
boolean
session.serialize_handler
string
session.gc_probability
integer
session.gc_divisor
integer
session.gc_maxlifetime
integer
Informacja:
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.
Informacja: 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.
session.referer_check
string
session.entropy_file
string
Informacja: As of PHP 5.4.0 session.entropy_file defaults to /dev/urandom or /dev/arandom if it is available. In PHP 5.3.0 this directive is left empty by default.
session.entropy_length
integer
Informacja:
The expiration timestamp is set relative to the server time, which is not necessarily the same as the time in the client's browser.
session.cache_limiter
string
session.cache_expire
integer
session.use_trans_sid
boolean
Informacja: 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.
session.bug_compat_42
boolean
session.bug_compat_warn
boolean
session.hash_function
mixed
Since PHP 5.3.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.
Informacja:
This setting was introduced in PHP 5.
session.hash_bits_per_character
integer
Informacja:
This was introduced in PHP 5.
Informacja: If you want HTML/XHTML strict conformity, remove the form entry and use the <fieldset> tags around your form fields.
session.upload_progress.enabled
boolean
session.upload_progress.cleanup
boolean
Informacja: It is highly recommended to keep this feature enabled.
session.upload_progress.prefix
string
session.upload_progress.name
string
session.upload_progress.freq
mixed
session.upload_progress.min-freq
integer
The track_vars and register_globals configuration settings influence how the session variables get stored and restored.
Upload progress will not be registered unless session.upload_progress.enabled is enabled, and the $_POST[ini_get("session.upload_progress.name")] variable is set. See Session Upload Progress for mor details on this functionality.
Informacja:
As of PHP 4.0.3, track_vars is always turned on.