Home > Backend Development > PHP Tutorial > PHP prompts Failed to write session data error solution, failedsession_PHP tutorial

PHP prompts Failed to write session data error solution, failedsession_PHP tutorial

WBOY
Release: 2016-07-13 10:11:31
Original
1040 people have browsed it

php prompts Failed to write session data error solution, failedsession

This article analyzes in detail the solution to the PHP prompt Failed to write session data error. Share it with everyone for your reference. The specific method is as follows:

1. Question:

Prompt message: Warning: Failed to write session data (files). Please verify that the current setting of session.save_path is correct () in Unknown on line 0

2. Solution:

The code is as follows:

Copy codeThe code is as follows:
session.save_path = "D:/phprun/tmp"

This is caused by a custom folder pointing error. The system will not appear by default. Sometimes, the prompt may be that the directory does not have write permissions, so everyone can just give permissions.

Due to the working mechanism of PHP, it does not have a daemon thread to regularly scan Session information and determine whether it is invalid. When a valid request occurs, PHP will based on the values ​​​​of the global variables session.gc_probability and session.gc_divisor, To decide whether to enable a GC, by default, session.gc_probability=1, session.gc_divisor =100 means there is a 1% possibility of starting a GC (that is, only one gc in 100 requests will be accompanied by 100 Started by a request).

The job of the PHP garbage collection mechanism is to scan all Session information, subtract the last modification time of the session from the current time, and compare it with the session.gc_maxlifetime parameter. If the survival time exceeds gc_maxlifetime (default 24 minutes), the session will be delete.

However, if your web server has multiple sites, unexpected results may occur when GC processes sessions at multiple sites. The reason is: when GC is working, it does not distinguish between sessions of different sites.

I hope this article will be helpful to everyone’s PHP programming design.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/929091.htmlTechArticlephp prompt Failed to write session data error solution, failedsession This article analyzes the php prompt Failed to write in more detail Solution to session data error. Share it with everyone...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template