Home  >  Article  >  Backend Development  >  PHP uses session prompt [function.session-start]: open solution_PHP tutorial

PHP uses session prompt [function.session-start]: open solution_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:26:54874browse

When using php for background management, the user login page will prompt Warning: session_start() [function.session-start]: open... error, followed by failed: No such file or directory. This tells us that the directory no longer exists. Let me introduce the solution to the problem

For example, our test 111.php file has the following code

session_start();
$_SESSION['admin'] =$_POST['username'];
?>

Run code tips

Warning: session_start() [function.session-start]: open(/tmpsess_84cb589ea249708b09c3d5e6836fdd0d, O_RDWR) failed: No such file or directory (2) in E:webhtdocswww.111cn.net111.php on line 9

From the error message above, there is a failed: No such file or directory prompt, which tells me that the directory where the session cache is to be written cannot be found, so I know the reason

Solution

The SESSION file saving directory does not exist. Just build one. 
View PHP.INI
session.save_path = /tmp

Change to the path you want to save such as session.save_path = "E:/server/php5/session_temp"

Just restart the server.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/822511.htmlTechArticleWhen using php for background management, the user login page will prompt Warning: session_start() [function.session -start]: open... error, followed by failed: No such file or direc...
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