PHP hint failed to write session data error _php tutorial

Source: Internet
Author: User
We look at the failed to write session data hint will know that the session can not write, the solution is to set a Save_path path in the php.ini.

Error hints

Hint message: warning:failed to write session data (files).
Please verify this current setting of
Session.save_path is correct () in Unknown on line 0


Solutions

The code is as follows Copy Code

Session.save_path = "D:/phprun/tmp"


This is a custom folder to point to the error caused by default, the system does not appear, and sometimes it is possible that the directory does not have permission to write Oh, so we give permission to it.


Because of PHP's working mechanism, it does not have a daemon thread to periodically scan the session information and determine whether it is invalid, when a valid request occurs, PHP will be based on global variables session.gc_probability and SESSION.GC_ The value of divisor to determine whether a GC is enabled, by default, Session.gc_probability=1, session.gc_divisor = 100 which means there is a 1% possibility to start the GC ( This means that only one GC in 100 requests starts with one of the 100 requests.

PHP garbage collection mechanism is to scan all the session information, with the current time minus the last time the session was modified, compared with the session.gc_maxlifetime parameter, if the survival time exceeds gc_maxlifetime (default 24 minutes ), the session is deleted.
However, if your Web server has multiple sites, multiple sites, GC processing sessions can have unexpected results because the GC does not differentiate between sessions at different sites when it is working.

http://www.bkjia.com/PHPjc/633210.html www.bkjia.com true http://www.bkjia.com/PHPjc/633210.html techarticle We look at the failed to write session data hint will know that the session can not write, the solution is to set a Save_path path in the php.ini. Error message Tip: W ...

  • 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.