我在网上看到过这样的问题,但没有任何修复的运气。我在本地安装了laravel 4,我的会话效果很好。我可以登录使用…
Auth::login($user,true);
然后用…检查登录用户
Auth::check()
但是我发现一旦我推到我的生产环境,运行PHP 5.3会话不再工作。为了测试,我尝试手动为其他文章中的每个建议设置一个会话变量,并在另一个调用中重复它。再次在本地工作,而不是在prod上。有人处理过这个问题吗?
谢谢
您是否检查了生产服务器上的会话保存路径并确保其可写?同时确保app/storage目录的chmoded为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可写的,这可能会清理你的问题。