gpt4 book ai didi

服务器端PHP session_start()错误

转载 作者:行者123 更新时间:2023-12-02 06:24:04 27 4
gpt4 key购买 nike

我目前正在尝试将我的网站从我机器上的本地主机移动到我的网络服务器。还有一个问题。

一切正常,除了用于管理的登录表单。

起初我以为是 not-saving-as-utf-8-without-BOM 问题,但是错误日志显示了一些我以前从未遇到过的奇怪问题。据我了解,问题是关于在服务器上保存 session 数据,请参阅下面的错误日志。

PHP Warning:  session_start() [<a href='function.session-start'>function.session-start</a>]: open(/var/php_sessions/sess_cd9931f63118e645ca5d3704fecf86c6, O_RDWR) failed: No such file or directory (2) in /hermes/bosweb/web273/b2738/ipg.mydomaincom/admin/login.php on line 2 
PHP Warning: Unknown: open(/var/php_sessions/sess_cd9931f63118e645ca5d3704fecf86c6, O_RDWR) failed: No such file or directory (2) in Unknown on line 0
PHP Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/php_sessions) in Unknown on line 0
PHP Warning: session_start() [<a href='function.session-start'>function.session-start</a>]: open(/var/php_sessions/sess_cd9931f63118e645ca5d3704fecf86c6, O_RDWR) failed: No such file or directory (2) in /hermes/bosweb/web273/b2738/ipg.mydomaincom/admin/include/header.php on line 2
PHP Warning: Unknown: open(/var/php_sessions/sess_cd9931f63118e645ca5d3704fecf86c6, O_RDWR) failed: No such file or directory (2) in Unknown on line 0
PHP Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/php_sessions) in Unknown on line 0

这是我用于 login.php 文件的代码:

<?php
session_start ();
require_once 'config/config.php';
$auth = "SELECT username, password FROM admin";
$dbi = mysql_query($auth, $connection);
$row = mysql_fetch_array($dbi);

if($_POST["username"] == $row['username'] && MD5($_POST["password"]) == $row['password'])

{
$_SESSION["Login"] = "true";
header ("Location: index.php");
}
else
{
$_SESSION["Login"] = "false";
//error msg
echo "<html>
<head><title>Failed Login Attempt</title></head>
<body>
Ops! Unlucky guess, try again!
<a href='index.php'>Go Back</a>
</body>
</html>
";
}
?>

最佳答案

第一步,检查目录 /var/php_sessions/ 是否存在并且可由您的网络服务器写入。

关于服务器端PHP session_start()错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3843417/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com