doujia6433
2019-03-28 04:29
浏览 79
已采纳

当我使用会话从页面发送值到另一个页面时,出现以下错误[重复]

This question already has an answer here:

Warning: session_start(): open(/var/cpanel/php/sessions/ea-php56/sess_c84fdb91458e26c7325faf74a529a3, O_RDWR) failed: No such file or directory (2) in /home/username/public_html/test2.php on line 3

Warning: session_start(): Failed to read session data: files (path: /var/cpanel/php/sessions/ea-php56) in /home/username/public_html//test2.php on line 3

Notice: Undefined index: username in /home/username/public_html/test2.php on line 4

i used this code but add

(error_reporting(E_ALL); 
ini_set('display_errors', 1);) 

to above of test2.php

</div>

图片转代码服务由CSDN问答提供 功能建议

此问题已经存在 这里有一个答案:

  • 警​​告:session_start()失败:没有这样的文件或目录 4 answers

    警告:session_start() : 打开(/ var / cpanel / php / sessions / ea-php56 / sess_c84fdb91458e26c7325faf74a529a3, O_RDWR)失败:第3行的 /home/username/public_html/test2.php中没有此类文件或目录(2)

    警告:session_start():无法读取会话数据: / home / username /中的文件(路径: / var / cpanel / php / sessions / ea-php56) 第3行的public_html // test2.php

    注意:未定义的索引: / home / us中的用户名 第4行的ername / public_html / test2.php

    我使用了此代码但添加 \ ñ

     <代码>(使用error_reporting(E_ALL);  
    ini_set('display_errors',1);)
       
     
     

    以上 test2.php

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • doureng6738 2019-03-28 04:36
    已采纳

    Your session directory /var/cpanel/php/sessions/ea-php56/ on sever may be not exist or you do not have permissons to access to it.

    Create directory if not exist with proper permissions or change session directory in php.ini file. If you dont have access to server contact your service provider.

    You can set below line before accesing or creating sesssion to change session directory for your script.

    ini_set('session.save_path', '/path/to/your/folder')
    

    https://www.php.net/manual/en/function.session-save-path.php

    打赏 评论

相关推荐 更多相似问题