What to do if php session fails

藏色散人
Release: 2023-03-12 13:24:01
Original
3561 people have browsed it

Solution to invalid php session: 1. Modify the address of "session_save_path"; 2. Find the temp folder on the computer and modify the permissions; 3. Restart IIS to make the modification effective.

What to do if php session fails

The operating environment of this article: Windows 2008 system, PHP version 7.1, DELL G3 computer

What should I do if the php session fails?

Solution to session unavailability in php

## Recently, because I have just come into contact with PHP, the code previously tested on the cloud server needs to be moved to the 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 not available. Later, I checked online that it was due to a problem with the session storage directory in the PHP configuration file on the server. After some tossing, I roughly summarized the entire problem. The following instructions

take Windows 2008 server as an example.

1. Modify the address of session_save_path

session_save_path is the directory where session files are stored. If the directory is invalid or the file does not have write permission, the session will be unavailable.

Then first open the installation address of php in the server and open the php.ini configuration file. Then use ctrl F to search where session_save_path is found. First check whether the subsequent storage directory is a valid directory path. If it is invalid, change it to a valid folder directory. You can create a new directory and create the folder in the actual disk. The path I modified myself is the directory of c:/Windows/Temp.

What to do if php session fails

2. Modify permissions

The storage directory that has been created or modified in the previous step is not feasible if the folder does not have write permissions. . Then we still need to modify the permissions.

Find the folder on your computer, right-click Properties-Security-select Users-Edit-check the write permission.

What to do if php session fails

What to do if php session fails

What to do if php session fails##3. Restart IIS to make the changes take effect

Open IIS in the server (you can't find this anywhere, you can 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 it helps everyone.

Recommended learning: "

PHP Video Tutorial

"

The above is the detailed content of What to do if php session fails. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!