在设置会话 cookie 之前,我会得到一个空白页面 - PHP 4.4.9

发布于 2024-11-04 11:17:17 字数 1240 浏览 6 评论 0原文

我第一次访问时,我会看到一个空白页面 - 如果我单击“查看源代码”,则没有任何文本,但会添加会话 cookie。 第二,一切都按其应有的方式进行。 如果我删除 cookie,我会再次得到一个空白页。 所有浏览器均相同 - Firefox 4、IE 9、Chrome 11。 PHP 4.4.9

<?php
session_start();
echo "hello";
?>

更新:

Session Support     enabled
Registered save handlers    files user 

session.auto_start  Off Off
session.bug_compat_42   On  On
session.bug_compat_warn On  On
session.cache_expire    180 180
session.cache_limiter   nocache nocache
session.cookie_domain   no value    no value
session.cookie_lifetime 0   0
session.cookie_path /   /
session.cookie_secure   Off Off
session.entropy_file    no value    no value
session.entropy_length  0   0
session.gc_divisor  100 100
session.gc_maxlifetime  1440    1440
session.gc_probability  1   1
session.name    PHPSESSID   PHPSESSID
session.referer_check   no value    no value
session.save_handler    files   files
session.save_path   /tmp    /tmp
session.serialize_handler   php php
session.use_cookies On  On
session.use_only_cookies    Off Off
session.use_trans_sid   On  On

这是我的会话 phpinfo 我已经尝试过 ini_set("display_errors", 1); 我还尝试将 ini_set('error_log') 设置为可写文件夹中的文件,但没有收到任何错误(即使我将“asdfasdf(asdf(0)}”写入第一行。)

The first time I visit, I get a blank page - no text whotsoever if i click "view source", but a session cookie is added.
The second, everything runs as it should.
If I delete the cookie, I get a blank page again.
Same in all browsers - Firefox 4, IE 9, Chrome 11.
PHP 4.4.9

<?php
session_start();
echo "hello";
?>

Update:

Session Support     enabled
Registered save handlers    files user 

session.auto_start  Off Off
session.bug_compat_42   On  On
session.bug_compat_warn On  On
session.cache_expire    180 180
session.cache_limiter   nocache nocache
session.cookie_domain   no value    no value
session.cookie_lifetime 0   0
session.cookie_path /   /
session.cookie_secure   Off Off
session.entropy_file    no value    no value
session.entropy_length  0   0
session.gc_divisor  100 100
session.gc_maxlifetime  1440    1440
session.gc_probability  1   1
session.name    PHPSESSID   PHPSESSID
session.referer_check   no value    no value
session.save_handler    files   files
session.save_path   /tmp    /tmp
session.serialize_handler   php php
session.use_cookies On  On
session.use_only_cookies    Off Off
session.use_trans_sid   On  On

This is my phpinfo on sessions
I've already tried ini_set("display_errors", 1);
I've also tried setting ini_set('error_log') to a file in a folder that is writable, but I don't get any errors (even if I write "asdfasdf(asdf(0)}" as the first line.)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

不必了 2024-11-11 11:17:17

听起来像是您的 php.ini 的问题,

我会检查“session.save_path”和“session.use_cookies”条目以及引用的目录(权限等)。还可以使用 phpinfo() 来发现配置错误。

Sounds like an issue with your php.ini

I would check the "session.save_path" and "session.use_cookies" entries and the directories referenced (permissions etc). Also use phpinfo() to spot configuration errors.

半世蒼涼 2024-11-11 11:17:17

作为解决方法,请在启动会话之前检查会话,并在启动后立即刷新/重定向页面

as a workaround, check for the session before you start it and refresh/redirect the page imediately after you start it

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文