简体   繁体   English

session_name打破了我的网站?

[英]session_name breaks my site?

After reading through the PHP manual, I added session_name('mysite'); 阅读完PHP手册后,我添加了session_name('mysite'); to my code to ensure that collisions between sessions won't happen if I will run multiple apps in the future. 我的代码,以确保如果我将来运行多个应用程序不会发生会话之间的冲突。

Unfortunately the session_name() -function call it kills my site completely . 不幸的是session_name()函数调用它完全杀死了我的网站。 A fatal error is thrown (which appears in the error logs, but doesn't say anything!) and the below error is shown in the browser: 抛出致命错误(出现在错误日志中,但没有说出任何内容!)并在浏览器中显示以下错误:

I have PHP-FPM running along with suhosin+nginx at a freshly installed Ubuntu VM. 我在新安装的Ubuntu VM上运行了PHP-FPM和suhosin + nginx。 What am I doing wrong? 我究竟做错了什么?

NGINX

As pointed out in the comments on the session_name doc page , there are some issues w/ session_name that can cause your site to break: 正如session_name doc页面上的注释中所指出的,有一些问题可能会导致您的站点中断的session_name:

  1. Make sure that you call session_name before anything else , including session_start 确保调用session_name ,包括session_start
  2. Make sure there are no periods in your session name (ie: don't use "mysite.com" as your session name) 确保会话名称中没有句点(即:不要使用“mysite.com”作为会话名称)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM