切换服务器后,为什么Laravel Sessions仅在Safari和IE中失败? [英] Why would Laravel Sessions fail in just Safari and IE after switching server?

查看:119
本文介绍了切换服务器后,为什么Laravel Sessions仅在Safari和IE中失败?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

带有Webmin,Apache Centos 6,Laravel应用程序和旧数据库架构的新型VPS服务器.一切都可以在旧的共享主机上正常工作,但是在VPS上由于某种原因,Laravel的会话存储(Laravel 3.0)在Safari或Internet Explorer上不再可用.

New VPS server with Webmin, Apache Centos 6, Laravel application and old database schema. All working fine on old shared host, but on VPS for some reason Laravel's Session storage (Laravel 3.0) is no longer working on Safari or Internet Explorer.

似乎会话ID并没有保存在客户端上.是一种将Laravel会话ID强制保存在客户端浏览器上的好方法吗?

It seems that the Session ID is just not saving on the client. Is a good way to force the Laravel Session ID to save on the clients browser?

当Chrome/Firefox看起来运行良好时,Safari/IE存储cookie可能会造成此问题的方式之间有什么区别?

What are the differences between the way Safari/IE store cookies that might be creating this problem, when Chrome/Firefox appear to be working perfectly fine?

推荐答案

如果服务器上的时间/时区不正确,则Cookie可能会弯腰.检查服务器上的时区/时间设置.

Cookies can get knickers in a twist if the time/timezone on the server is not correct. Check the timezone / time setting on the server.

请注意,您需要检查操作系统中的实际时间/时区,而不仅仅是PHP中的时区.但是您可以通过将PHP(date_default_timezone_set())中的时区设置为本地时间并要求PHP提供日期来验证使用PHP.如果不匹配,则服务器设置不正确.请注意,在PHP中调整时区以使其看起来正确并不能解决Cookie问题,必须在操作系统中使用日期"正确设置操作系统时间/时区.

Note that you need to check the actual time/timezone in the OS, not just the timezone in PHP. But you can verify using PHP by setting timezone in PHP (date_default_timezone_set()) to your local time and asking PHP for the date; if it doesn't match then the server is set incorrectly. Note that adjusting the Timezone in PHP to make it look right won't fix the cookie problem, you must set the OS time/timezone correctly using "date" in the OS.

验证这是否是问题的另一种方法:将Cookie设置为在一年后过期-它们会显示吗?如果时区错误,则会显示(>时区差异),但2小时的cookie可能不会(

原因:由于使用实际时间设置了Cookie(即此Cookie将于2013年7月25日15:13 GMT过期").如果您的本地计算机与服务器的设置不同,则cookie可能在发送之前似乎已过期.一些浏览器对此进行了纠正(以前是FF,Chrome现在也可能).

Another way of verifying if this is the problem: set a cookies to expire in a year - do they show? If the timezone is wrong then these will show (>timezone difference), but a 2 hour cookie may not (

Reason: As cookies are set using the actual time (i.e. "this cookie expires 25th July 2013 15:13 GMT"). If your local computer is set differently from the server, then the cookie may appear expired before it's sent. Some browsers correct for this (FF used to, Chrome may now also).

由于此处更改的是服务器,因此请检查服务器上的时间. (还要仔细检查您自己的计算机,以确保其正常工作.)

As the thing that changed here is the server, check the time on your server. (Also double check your own computer for good measure).

这篇关于切换服务器后,为什么Laravel Sessions仅在Safari和IE中失败?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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