Summary of invalid PHPSession loss-PHP source code

Source: Internet
Author: User
Many of my friends in application development may encounter invalid session or session loss problems. Let's sort out some problems and solutions that cause invalid PHPSession loss. Many of my friends in application development may encounter invalid sessions or session loss problems. Let's sort out some problems and solutions that may cause invalid PHP session loss.

Script ec (2); script

Two days ago, I played a light blog on the cloud side. I felt that something was relatively small and I wanted to get something, so I put it directly into the server. The result is !!! $ _ SESSION has been lost for several days ~
Description:

$ _ SESSION can only be valid for the current access. The second request is as if it was previously executed Www.111cn.net session_destroy ()

Similarly, the content in $ _ SESSION will be gone.

Array ();

;
The following is my search Target route for this problem:
1. session_start (): think that $ _ SESSION can be used to write the value stored in each access, and it will be immediately removed;
2. session expiration: however, this line is found in the Code.

The Code is as follows:

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

, So this is not the reason;
3. cookie disabled: Check the storage of COOKIES in a browser, and nothing is disabled. The values written in the program are printed $ _ and all COOKIES are excluded;
4. speedphp problems: no similar situations have been found when the related keywords are searched on the Internet. Most of the problems are that a $ _ SESSION variable is lost in one write, this is not the case with me. Then, I added session_start (); some other debugging variables and printing, but there was still no result, and I also ruled out it;
5. "session is only valid for the current access. The second access is like executing session_destroy (). No content is available, what are the causes? Thinking ...", Ah, that is "Qinhuai district (234427967) 20:32:45 the disk can not be written" back to the result, immediately go to/etc to open php. ini looks at the session storage path and cd all the way in. The speed is "ll", ah !!!! It was speechless.

The Code is as follows:

Drwxrwx --- 2 root apache xxxx ....

There was no language at that time.

The Code is as follows:

Chmod 777 session

After, tangle removed ~
Conclusion: The SESSION is lost. Remember to start with the directory permission first.

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.