Gunel Gunel - 22 days ago 7
PHP Question

Session in Laravel 5.4.3 doesn't works

I have a problem with session in laravel ,
In localhost works fine , but in shared hosting (webhostingworld) dosen't work
Same code.
This is the code in session.php

<?php
return [
'driver' => env('SESSION_DRIVER', 'file'),
'lifetime' => 120,
'expire_on_close' => false,
'encrypt' => false,
'files' => storage_path('framework/sessions'),
'connection' => null,
'table' => 'sessions',
'store' => null,
'lottery' => [2, 100],
'cookie' => 'laravel_session',
'path' => '/',
'domain' => '',
'secure' => env('SESSION_SECURE_COOKIE', false),
'http_only' => true,

];


This is the code in web.php

Route::get('/put',function(){
Session::put('test','testing');
return Session::get('test'); //here returning testing
});
Route::get('/get',function(){
return Session::get('test'); //but here return empty result
});


Server PHP Version 5.6.31 , SSH access is not possible to shared host

Answer Source

Problem was found, i have created settings.php file for uploading images specific folders, after deleting that file from hosting session worked