2plus
2plus

Reputation: 261

Laravel 4: Session is not working in server

session::set and session::get is not working in laravel

Session is working in local machine. But when I test in live server, it is not working.

Scenario: While logging into an application Auth::attempt returns true. But again it redirected to login page. This is an exact issue.

Auth::check method return true under the auth::attempt condition. But in login page and filter.php, Auth::check method return false.

I don't know why :(

I tested it with a laravel session variable. I assigned a value in a session variable and redirected the page to another page where I have echoed the session. It return empty.

Additional Detail: It does not retain the session flash message in server. It is working in local.

Please advice.

Upvotes: 0

Views: 1754

Answers (1)

lowerends
lowerends

Reputation: 5267

If your session driver is file, then make sure your (storage) path is writable by PHP. Look for this in your session.php file:

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

Upvotes: 1

Related Questions