Invalid PHP session loss problem

Source: Internet
Author: User
Tags php session valid

Two days ago to play a little cloud side of the light blog, think things relatively small, they also want to get something, directly put into the server installed, the result AH!!! $_session lost for several days ~

Situation Description:

$_session can only be valid in the current access, and the second request is like the previous Session_destroy ()

Like, the contents of the $_session will be gone, just one

Array ();


Here's how I find the target route for this problem:

1. Session_Start (): Think of every visit can be used to write the value of $_session, immediately removed;

2. Session expiration: But found in the code in such a line

The code is as follows

Ini_set (' Session.gc_maxlifetime ', $lefttime);

, so it is not the reason;

3. Cookies disabled: View a browser in the storage of cookies, there is nothing to be disabled, the program written in the value, with a print $_cookies are in, also ruled out;

4. speedphp problem: Online search for the relevant keywords also did not find a similar situation, more is said in a write lost a $_session variable, and I this situation is not the same, and then add their own line session_start (); With some other debugging variables and printing, but still no results, also excluded;

5. Help Netizen: Send a request for help information "session can only be valid in the current visit, the second visit feel like the implementation of Session_destroy (), before all content is gone, what is the reason? Ask for ideas ...", ah that is called "Qinhuai Childe (234427967) 20:32:45 disk can not write "back to the fruit of a piece, immediately to/etc open PHP.ini see the session of the storage path, all the way CD in, fast" LL ", AH!!!! There was no language at the time.

The code is as follows

DRWXRWX---2 root apache xxxx ....

There was no language at the time.

The code is as follows

chmod 777 Session

After the tangle lifted ~

Conclusion: Session is missing, remember to start with directory permissions first

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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: and provide relevant evidence. A staff member will contact you within 5 working days.