0

我刚刚转移到共享主机上的 linux 服务器,看看它是否比 godaddy 上的 windows 服务器更垃圾(我已经愚蠢到提前 12 个月付钱给他们,所以我现在被那些白痴困住了)。我现在根本无法使用任何类型的会话。

他们回复我说由我来解决问题以使其正常工作......是的,这是正确的......让会议正常工作!对不起,如果我看起来有点生气,但我很生气。

有人可以告诉我如何以某种方式让会话在 Apache 服务器上工作吗?我以前从来没有设置过这个,因为它从来都不是问题。只要我这样做:

    <?php session_start() ?>

...它只是提出了大约 8 行错误说:

Warning: session_start() [function.session-start]: open(/var/chroot/home/content/30/10247530/tmp/sess_sgruthqkbhfms6ekcle2l0n6i5, O_RDWR) failed: No such file or directory (2) in /home/content/30/10247530/html/sessionthing.php on line 2

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/content/30/10247530/html/sessionthing.php:2) in /home/content/30/10247530/html/sessionthing.php on line 2

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/content/30/10247530/html/sessionthing.php:2) in /home/content/30/10247530/html/sessionthing.php on line 2

Warning: Unknown: open(/var/chroot/home/content/30/10247530/tmp/sess_sgruthqkbhfms6ekcle2l0n6i5, O_RDWR) failed: No such file or directory (2) in Unknown on line 0

Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct () in Unknown on line 0

我尝试创建一个 php.ini 文件,但仍然无法使其正常工作。我已经使用 phpinfo() 检查了设置,但我真的不知道从这里去哪里。

编辑:现在页面侧面出现了一些指向类似问题的东西。由于某种原因,我在搜索时没有想出那些。其中一个甚至已关闭:https ://stackoverflow.com/questions/11374110/session-start-errors-on-godaddy-server?rq=1

那个人说他们已经和 Godaddy 解决了,所以我想我必须回去告诉他们解决问题。并不是我不想学习如何配置服务器……只是会话应该正常工作。

4

2 回答 2

1

PHP 试图将会话保存在 中/var/chroot/home/content/30/10247530/tmp/,但它无法打开该目录(因为它不存在或因为它没有写入权限)。调查 PHP 对这条路径的访问,我相信你会让你的会话正常工作 - 也许你在将代码迁移到新服务器时忽略了一个配置变量?

于 2013-04-04T11:21:47.173 回答
1

确保没有其他<?php session_start() ?>声明,并尝试设置自己的会话临时路径,

<?php
  if (!is_dir(session_save_path())) {
      session_save_path ('your/custom/existing/directory');
   }
 session_start();
 ?>
于 2013-04-04T11:37:51.470 回答