the session variables are automatically destroyed in laravel

3

hi I have a project in laravel that installs it in a shared hosting, this project works properly locally, but when uploading it to the hosting, the session variables have stopped working or are lost immediately when sending a form. for example I have a function:

public function create(){   
/Session::put('mi_variable','hola mundo');    
dd(\Session::get('mi_variable')); // Aquí si se imprime.   
return view('vistas.formulario'); 
} 
public function imprimirVariableDeSesion(){   dd(\Session::get('mi_variable'));//Aquí no se imprime. 
}

when the form that returns in the first function is shown and sends me to the function (imprimirVariableDeSesion) , this variable is no longer displayed

    
asked by Santiago Ochoa Estrada 28.01.2017 в 01:26
source

1 answer

0

It happened to me once The problem seems to be that the host has put the session_path in a directory that no longer exists, so the session data is not saved.

You can fix it in two ways

  • Putting in each of your scripts  ini_set ('session.save_path', 'ALGUN_PATH_QUE_SEPAS_EXISTA');
  • Talking to your host server about the problem and expecting it to be fixed: D
  • answered by 29.01.2017 / 20:55
    source