【发布时间】:2013-07-29 16:03:04
【问题描述】:
我在服务器上托管了多个站点,其中大多数站点在用户登录时使用会话。
例如,如果用户登录成功,我有一个会话变量$_SESSION["loggedin"] = 'yes'。
这在多个站点上是相同的,但如果我同时登录说 2 个站点,其中一个站点将停止工作并显示这些错误:
Warning: session_start() [function.session-start]: open(/tmp/sess_8f7b4997fbfdd08855a410ae4638821f, O_RDWR) failed: Permission denied (13) in /home/theboaty/public_html/new_site/admin/authorisation.php on line 2
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/theboaty/public_html/new_site/admin/authorisation.php:2) in /home/theboaty/public_html/new_site/admin/authorisation.php on line 2
Warning: Cannot modify header information - headers already sent by (output started at /home/theboaty/public_html/new_site/admin/authorisation.php:2) in /home/theboaty/public_html/new_site/admin/authorisation.php on line 5
Warning: Unknown: open(/tmp/sess_8f7b4997fbfdd08855a410ae4638821f, O_RDWR) failed: Permission denied (13) 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 (/tmp) in Unknown on line 0
注意:authorisation.php 检查 loggedin 会话变量以查看用户是否已登录
【问题讨论】:
-
您是否在站点之间共享(或有意或无意地)相同的会话 ID?
-
添加新站点时,代码只是被复制。不是故意的
-
如果您使用的是Firefox,可以通过右键单击页面并选择“查看页面信息->安全->Cookies”来访问cookie管理器。
-
您的会话正在设置 cookie。
-
通过 cookie 管理器,您可以看到哪些会话 id 是活动的。看起来“authorisation.php”试图对所有站点使用相同的会话。