繁体   English   中英

Laravel 4 Sessions不能持续使用PHP 5.3

[英]Laravel 4 Sessions Not persisting with PHP 5.3

我在网上看到了类似的问题,但是还没有运气修复。 我在本地安装了laravel 4,并且我的会议效果很好。 我可以使用...登录

Auth::login($user,true);

然后使用...检查登录用户。

Auth::check()

但是我发现一旦启动了运行PHP 5.3会话的生产环境,它就不再起作用。 为了进行测试,我尝试根据其他文章的建议手动设置会话变量,并在其他调用中将其回显。 再次在本地工作,不在产品上。 有没有人处理过这个问题?

谢谢

您是否在生产服务器上检查了会话保存路径并确保其可写。 还要确保app / storage目录已更改为777。

检查的相关文件将是php.ini

[Session]
; Handler used to store/retrieve data.
; http://php.net/session.save-handler
session.save_handler = files

; Argument passed to save_handler.  In the case of files, this is the path
; where data files are stored. Note: Windows users have to change this
; variable in order to use PHP's session functions.

;
; The path can be defined as:
;
;     session.save_path = "N;/path"
;
; where N is an integer.  Instead of storing all the session files in
; /path, what this will do is use subdirectories N-levels deep, and
; store the session data in those directories.  This is useful if
; your OS has problems with many files in one directory, and is
; a more efficient layout for servers that handle many sessions.

和/app/config/sessions.php

/*
|--------------------------------------------------------------------------
| Session File Location
|--------------------------------------------------------------------------
|
| When using the native session driver, we need a location where session
| files may be stored. A default has been set for you but a different
| location may be specified. This is only needed for file sessions.
|
*/

'files' => storage_path().'/sessions',

/*

可能再次指向存储文件夹。 我将确保这是777可写的,并且可以解决您的问题。

暂无
暂无

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

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