Why do I set ini_set ("session. gc_maxlifetime", 1); invalid?

Source: Internet
Author: User
Why do I set ini_set (session. gc_maxlifetime, 1); invalid?
 

I set ini_set ("session. gc_maxlifetime", 1); the session is valid for 1 minute.
How can I get the value of $ _ SESSION ["name"] after I access test. php in the same folder one minute? Should it be null?
After 2 hours, you can still get it.
What else do I need to set?

 

This is my test. php code.


Reply to discussion (solution)

I am also a newbie
If you don't mind, give me a small suggestion. try again...

Set
Ini_set ("session. gc_maxlifetime", 1 );

Put it behind session_start ();

I am also a newbie
If you don't mind, give me a small suggestion. try again...

Set
Ini_set ("session. gc_maxlifetime", 1 );

Put it behind session_start ();


Have you done this before?


I am also a newbie
If you don't mind, give me a small suggestion. try again...

Set
Ini_set ("session. gc_maxlifetime", 1 );

Put it behind session_start ();


Have you done this before?


I tried before
This makes time effective.

But it has been modified in other codes. I don't know if this is the most direct reason.

Sessions time

The modification time is not enough. php has a gc mechanism, that is, the garbage collection mechanism. by default, only 1/100 or 1/1000 of the probability will be deleted after the session file expires, you can modify the session. gc_pisor = 1, session. gc_probability = 1. after the session file expires, the session file is deleted with a 100% probability when the session file is triggered by the session initialization action.

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.