Laravel 4 Sessions不持久使用PHP 5.3

时间:2014-03-21 20:45:20

标签: php session laravel

我在网上看到过类似的问题,但修复工作没有任何好运。我有本地安装的laravel 4,我的会话很棒。我可以使用...

登录
Auth::login($user,true);

然后使用...

检查登录用户
Auth::check()

但是我发现,一旦我推到我的生产环境,运行PHP 5.3会话就不再有用了。为了测试,我试图从其他文章的建议中手动设置会话变量,并在其他另一个调用中回显它。再次在当地工作,而不是生产。有人曾经处理过这个问题吗?

由于

1 个答案:

答案 0 :(得分:0)

您是否检查过生产服务器上的会话保存路径并确保其可写。还要确保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可写的,这可能会清理你的问题。