Recently, because I just came into contact with php, the code previously tested on the cloud server needs to be moved to a new server (version Windows 2008 server). The php version is 5.5.12. It turns out that the session function in the original php code is unavailable. Later, I checked the Internet and it was due to the problem of the session storage directory in the php configuration file on the server. After some tossing, I can summarize the whole problem. The following descriptions
use Windows 2008 server as an example.
One, modify the address of session_save_path
session_save_path is the storage directory of session files. If the directory is invalid or the file does not have permission to write, the session will be unavailable.
Then first open the installation address of php in the server, and open the php.ini configuration file. Then ctrl+F search to find the place of session_save_path, first check whether the following storage directory is a valid directory path, if invalid, change it to a valid folder directory, you can create a new directory, and create a new folder in the actual disk. The path I modified myself is the directory of c:/Windows/Temp.
Second, modify the permissions
The storage directory that has been created or modified in the previous step is not feasible if the folder does not have write permission. Then we also need to modify the permissions.
Find the folder on your computer, right-click Properties - Security - Select Users - Edit - tick the write permission.
Third, restart IIS to make the changes take effect
Open IIS in the server (this can't be found where to search online), and restart IIS.
At this point, the setting of session_save_path is complete. Hurry up and try the session function again to see if it works. Hope to help everyone.