[PHP] session storage

Source: Internet
Author: User
First, check whether the session is automatically enabled or you need to manually enable it through session_start ():; specify whether the session module automatically starts a session when the request starts. The default value is 0 (not started); Initializesessiononrequeststartup .; http://php.net/se ... "/> <Scripttype =" text first, check whether the session is automatically enabled or you need to manually enable it through session_start ():; specify whether the session module automatically starts a session when the request starts. The default value is 0 (not started); Initialize session on request startup .; http://php.net/se Ssion. auto-startsession.auto_start = 0 the client is stored on the client, and sessions can be stored on cookies or obtained through URL parameters. Depending on the server configuration:; specifies whether to use cookies on the client to store Session IDs. The default value is 1 (enabled); Whether to use cookies .; http://php.net/se Ssion. use-cookiessession.use_cookies = 1; specifies whether to store Session IDs only using cookies on the client .. Enabling this setting can prevent attacks related to passing session IDs through URLs .; This option forces PHP to fetch and use a cookie for storing and maintaining; the session id. we encourage this operation as it's very helpful in combatting; session hijacking when not specifying and managing your own session id. it is; not the end all be all of session hijacking defense, but it's a good start .; http://php.net/se Ssion. use-only-cookiessession.use_only_cookies = 1 if you confirm that the session is stored in the cookie, you can configure the session in the cookie, such as cookie_name, cookie_lifetime, cookie_path, cookie_domain, cookie_secure, cookie_httponly; name of the session (used as cookie name ).; http://php.net/se Ssion. namesession. name = PHPSESSID; Lifetime in seconds of cookie or, if 0, until browser is restarted .; http://php.net/se Ssion. cookie-lifetimesession.cookie_lifetime = 0; The path for which the cookie is valid .; http://php.net/se Ssion. cookie-pathsession.cookie_path =/; The domain for which the cookie is valid .; http://php.net/se Ssion. cookie-domainsession.cookie_domain =; Whether or not to add the httpOnly flag to the cookie, which makes it inaccessible to browser scripting versions ages such as JavaScript .; http://php.net/se Ssion. cookie-httponlysession.cookie_httponly = servers are stored on servers, and sessions can also be stored in multiple ways. The default session is stored in the file. session. save_path is the path for creating the storage file.; Handler used to store/retrieve data .; http://php.net/se Ssion. save-handlersession.save_handler = files; Argument passed to save_handler. in the case of files, this is the path; where data files are stored. note: Windows users have to change this; variable in order to use PHP's session functions .;; the path can be defined as:; session. save_path = "N;/path"; where N is an integer. instead of storing all the session files in;/path, what this will do is use subdirectories N-levels deep, and; store the session data in those directories. this is useful if you; or your OS have problems with lots of files in one directory, and is; a more efficient layout for servers that handle lots of sessions .;; NOTE 1: PHP will not create this directory structure automatically .; you can use the script in the ext/session dir for that purpose .; NOTE 2: See the section on garbage collection below if you choose to; use subdirectories for session storage; The file storage module creates files using mode 600 by default .; you can change that by using; session. save_path = "N; MODE;/path"; where MODE is the octal representation of the mode. note that this; does not overwrite the process's umask .; http://php.net/se Ssion. save-path; session. save_path = "/tmp" PHP supports the use of session_set_save_handler to implement custom open, close, read, write, destroy, gc processing functions of the session processor, common session processors include memory allocation (such as mm and memcache) and database storage. It can be seen that if Session storage and file systems (such as using PostgreSQL Session Save Handler or default file storage files) need to work together, in this case, the custom session processor may lose the session that has not stored data. If the memory type is used for storage allocation, session persistence storage needs to be considered. Next we will focus on memcache (d ?) Session processor. The Memcache module provides convenient process-oriented and object-oriented interfaces for memcached. memcached is a resident process cache product generated to reduce the workload of dynamic web applications loading data from databases. The Memcache module also provides a session processor (memcache ).

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.