dongxingdu9594 2014-10-27 08:31
浏览 63
已采纳

PHP没有创建会话

I was able to create sessions on 3 days ago. The code remained unchanged. But now I can't create session. Error Message: Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (c:\web\dev\session) in Unknown on line 0.

If I copy the path c:\web\dev\session into windows run command, it opens the path so I have verified that the path exists. I also get the error: Warning: session_start(): The session id is too long or contains illegal characters, valid characters are a-z, A-Z, 0-9 and '-,' in C:\Web\dev\backdoorequest.php on line 10 but I don't specify the PHP ID.

My code looks like this:

$user_row is a array with all the users data for the session in it.

session_save_path('c:\web\dev\session');
session_start();

$_SESSION['user'] = $user_row;
$_SESSION['security']['ip'] = $_SERVER['REMOTE_ADDR'];
if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
   $_SESSION['forwarded_for'] = $_SERVER['HTTP_X_FORWARDED_FOR'];
    } else {
       $_SESSION['security']['forwarded_for'] = false;
    }

I'm using Apache 2.4 and PHP 5.6

I have seen this link but it only seems to resolve the issue if you are using IIS. I can't seem to find the solution with Apache.

I have also tried to remove the .htaccess file from my root directory.

  • 写回答

1条回答 默认 最新

  • douzhixun8393 2014-10-27 10:02
    关注

    Try setting your php session id to something and see if that works.

    I had the same problem and when i set the php id to something it worked. I think its a bug or glitch in the new php version that needs to be addressed

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 使用C#,asp.net读取Excel文件并保存到Oracle数据库
  • ¥15 C# datagridview 单元格显示进度及值
  • ¥15 thinkphp6配合social login单点登录问题
  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配