How to Save SESSION data in PHP

Source: Internet
Author: User
How to save part of SESSION data in PHP The last time someone else gave me a list to save part of SESSION data in PHP, but the problem is that there is always an expiration that cannot be processed, here we will introduce the session expiration settings: In PHP, set php. ini, find the session. gc_maxlifetime = 1440 #(PHP5 is 24 minutes by default) how to save part of SESSION data in PHP

The last time someone gave me a list, I want to save some SESSION data in PHP, but the problem is that there is always an expiration that cannot be processed. here we will introduce the session expiration settings:


In PHP, set php. ini and find session. gc_maxlifetime = 1440 #(PHP5 is 24 minutes by default)

You can set the expiration time as needed, but some people say that it does not work after the setting!

In fact, it is not ineffective, but because the system default:

Session. gc_probability = 1

Session. gc_divisor = 1000

The garbage collection has a probability that 1/1000 means that the session is recycled only once for 1000 times.

As long as your traffic volume is high, the recovery effect can be achieved.

Otherwise, you can set the value of session. gc_divisor,

For example, session. gc_divisor = 1, so that you can see the effect of SESSION expiration)

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.