CodeIgniter does not load session when reloading

0

I work in an application with CodeIgniter and I have the problem that when I reload the page or call another controller I lose the values of the session variables.

I think so:

    $nuevoUsuario = array(
            'usuario' => $this->input->post('usuario'),
            'contrasena' => $this->input->post('contrasena')
        );
        // almacenar en sesion el usuario y la contraseña
        $this->session->set_userdata($nuevoUsuario);

In the first re-address I am loaded with the data well. I show them with:

 <?php print_r($this->session->userdata()) ?>

And I get:

Well, the problem is as I already commented, when I charge or call another controller that I lose that data, getting this:

As you can see, I lose the data and I change the ci_last_regenerate.

My CodeIgniter configuration is:

My php configuration in relation to the sessions is:

As seen, I put the:

$config['sess_cookie_name'] = 'PHPSESSID';

Same as the configuration returned by phpinfo () and still does not work. The thing is that the local works perfectly.

I have looked at documentation and tried a thousand ways that I see on the Internet and I can not find solutions. Has anyone happened to you?

Greetings.

    
asked by Carlos Rayón Álvarez 02.10.2018 в 13:16
source

1 answer

0

You must give the session cookie a name:

$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'NOMBRE DE COOKIE DE SESION';
$config['sess_expiration'] = 'Tiempo de expiracion de la sesión';
$config['sess_save_path'] = NULL;
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE;
    
answered by 02.10.2018 в 16:31