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.