search
HomeBackend DevelopmentPHP ProblemWhat to do if php session fails

What to do if php session fails

Sep 12, 2021 am 10:10 AM
phpsession

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!

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.