简体   繁体   English

会话无法启动(Symfony 2.7.1,Apache 2.2)

[英]Session doesn't start (Symfony 2.7.1, Apache 2.2)

So as title suggests, session doesn't start after submitting a form. 因此,正如标题所示,会话不会在提交表单后开始。 $_SESSION is null after submitting. 提交后, $_SESSION为空。 There are no errors, and redirect is to the page after successful login. 没有错误,成功登录后将重定向到页面。 I am pretty sure that is no related to any configuration problem in symfony, simply because I have exact copy on my local machine, and everything works fine. 我很确定,这与symfony中的任何配置问题都没有关系,仅仅是因为我在本地计算机上有准确的副本,并且一切正常。

That's why I think it's related with Apache 2.2. 这就是为什么我认为它与Apache 2.2有关。 auto-session is off in php.ini . 自动会话已在php.ini关闭。 Any suggestions? 有什么建议么?

You should use the Session Management of Symfony ( http://symfony.com/doc/2.3/components/http_foundation/sessions.html ) 您应该使用Symfony的会话管理( http://symfony.com/doc/2.3/components/http_foundation/sessions.html

As stated elsewhere, Symfony Sessions are designed to replace the use of PHP's native session_*() functions and use of the $_SESSION superglobal. 如其他地方所述,Symfony会话旨在取代PHP的本机session _ *()函数的使用以及$ _SESSION超全局变量的使用。 Additionally, it is mandatory for Symfony to start the session. 此外,Symfony必须启动会话。

( http://symfony.com/doc/current/components/http_foundation/session_php_bridge.html ) http://symfony.com/doc/current/components/http_foundation/session_php_bridge.html

Actually all of that was because of Varnish. 实际上,所有这些都是由于Varnish。 I didn't have Varnish for that project, at least I thought so, because I had configuration done wrong, and Varnish was working for both projects (that which I wanted, and which I don't). 我没有那个项目的Varnish,至少我是这么认为的,因为我的配置做错了,并且Varnish正在两个项目上工作(我想要的,我不想的)。 So I think the problems was with cached form (generally page). 因此,我认为问题出在缓存表单(通常是页面)上。 I think all of that, because recently I switched off Varnish, and everything working like it should. 我认为所有这些都是因为最近我关闭了Varnish,并且一切正常。

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

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