Symfony 2.1会话局部值和主值(在phpinfo上阅读) [英] Symfony 2.1 Session Local Value and Master Value (read on phpinfo)

查看:132
本文介绍了Symfony 2.1会话局部值和主值(在phpinfo上阅读)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我阻止从symfony 2.0迁移到symfony 2.1时,我在会话方面遇到问题.

我正在使用simplesamlphp进行身份验证,并且在symfony 2.0上一切正常.

在Symfony 2.1上,此操作不正确.我在phpinfo-> session上检查了它们之间的区别,这就是我得到的:

                          symfony2.1         symfony 2.0        Master Value
session.save_handler         user              files                files

session.save_path     (..)/symproject/app   (..)/wamp/tmp      (..)/wamp/tmp
                      /cache/dev/sessions

此值必须等于php.ini,因为simplesaml需要它!

我可以在config.yml上设置framework:session:save_path属性,但是我认为这不是一个好习惯,因为保存路径可能不同,具体取决于im是否在我的本地开发机器上(我在git上有我的项目)./p>

关于save_handler,我找不到在config.yml上指定它的方法.我坚持使用用户"吗?

此symfony版本中发生了什么?在symfony 2.0中,这是开箱即用的!请帮忙.没有关于它的体面文档(相信我,我已经看过!!).

解决方案

最后我明白了!

Symfony 2.1默认具有Native *驱动程序.这将覆盖php.ini上的现有配置.

如果要使用php-ini配置,则必须将null传递给处理程序arg的NativeSessionStorage构造函数.

这是通过将以下配置放在config.yml上完成的:

framework:
    session:
        handler_id: ~

有关此决定的更多信息,请参见此处.

symfony文档和升级手册中缺少此信息.

I'm having problems with sessions when i sarted migration from symfony 2.0 to symfony 2.1.

I'm using simplesamlphp for authentication and everything was working ok on symfony 2.0.

On Symfony 2.1 it is NOT OK. I checked the diferences between them on phpinfo->session and this what i got:

                          symfony2.1         symfony 2.0        Master Value
session.save_handler         user              files                files

session.save_path     (..)/symproject/app   (..)/wamp/tmp      (..)/wamp/tmp
                      /cache/dev/sessions

This values must be equal to php.ini since simplesaml requires it!

I could set the framework:session:save_path property on config.yml but i think this is not a good practice since save path might be diferent depending if im on my local development machine or not (i have my project on git).

And about save_handler i could not find a waay to specify it on config.yml. Am i stick with "user" on this?

What is happening in this symfony version?? In symfony 2.0 this was out of box! Please help. There is no decent documentation on this (believe me i've looked!!).

解决方案

Finally i've got it!

Symfony 2.1 had the Native* drivers by default. And this overrides configurations existing on php.ini.

If you want to use php-ini configs you must pass null to the NativeSessionStorage constructor for the handler arg.

This is done by putting the following configurations on config.yml:

framework:
    session:
        handler_id: ~

More information on this decision can be read here.

This information is missing from symfony docuymentation and upgrade manual.

这篇关于Symfony 2.1会话局部值和主值(在phpinfo上阅读)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆