Home  >  Article  >  php教程  >  Solution to space session failure

Solution to space session failure

WBOY
WBOYOriginal
2016-09-21 13:55:491716browse

When I visited my website today (by thinkphp), I suddenly found that the authentication failed, the Session could not cross pages, and when logging in, it always prompted a verification code error (the verification code was also passed through the Session), and then I realized that it might be Session is invalid. Since the space I rent is in an IIS environment, the Session may be stored in a fixed location, and that location is transparent (unknowable) to me. There may be a problem with it (full or permission issues, etc.), so I decided to change the location where the Session is stored. I found the following solution online and finally got it. The method is as follows:

There are many different ways to modify the session path. For example, you can modify it directly in the tp configuration file, or you can modify it in php.ini. Let’s take a look.

Modifying the session in TP is quite simple, and TP has taken it into consideration for us!

You only need to add:

in the project configuration file

'SESSION_OPTIONS' => array('path'=>'D:/thinkphp/sessions/')


You can also modify the configuration session.save_path in php.ini to comment it out. So where is the path saved by Seesion saved in different types of operating systems?

Linux:

/tmp or /var/lib/php/session

Windows:

C:/WINDOWS/Temp

Hope it can be helpful to children’s shoes who encounter the same problem.

Source: http://www.dqiu.net/doc/57e0a85100552

Statement:
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