How do Apache (wamp) stop killing the session by itself?

Asked

Viewed 792 times

3

I developed an application with laravel and left her spinning in the wamp, but after a while it ends up killing the user session, I wonder if there is any setting for it to stop doing this? Thank you!

3 answers

2

There are several types of settings you can make in Apache . htacess:

<IfModule mod_php5.c>

    # Definir o tempo máximo de execucao do script para 30 mins (padrão: 60s)
    php_value max_execution_time 1800

    # Definir o tempo de expiração de sessao para 2 horas (padrão: 24 mins)
    php_value session.cookie_lifetime 7200
    php_value session.cache_expire 7200
    php_value session.gc_maxlifetime 7200

</IfModule>

The documentation here: Session Configuration

You can also increase the expiration of the Session cache: Documentation

And a good read on PHP’s Séssion: Link Stackoverflow

2


Need to define the Session.cookie_lifetime and the probability of how much of the time the sessions expired will be collected. 0% = never.

Session.cookie_lifetime specifies the lifetime of the cookie in seconds that is sent to the browser. The value 0 means "until the browser is closed".

You can configure in your php.ini:

#definie para ficar ativo até o browser ser fechado
session.cookie_lifetime = 0

#  0 de probabilidade
session.gc_probability = 0

# 1 de divisão
session.gc_divisor = 1

# Logo o gc_maxlifetime vai ser checado 0% das vezes. (0 / 1 = 0%)
# ou seja, gc_probability / gc_divisor

# seta para ficar ativo até o browser ser fechado.
session.gc_maxlifetime = 0

You can configure directly in PHP at runtime:

// definie para ficar ativo até o browser ser fechado
ini_set('session.cookie_lifetime', 0); 

// 0 de probabilidade
ini_set('session.gc_probability', 0);

// 1 de divisão
ini_set('session.gc_divisor',1); 

// Logo o gc_maxlifetime vai ser checado 0% das vezes. 
// (0 / 1 = 0%) ou seja, gc_probability / gc_divisor

// ativo até o browser ser fechado
ini_set('session.gc_maxlifetime', 0);

// SOMENTE APÓS as configurações, abre a nova seção
session_start(); 

0

Check whether your php.ini , has a value for Session.gc_maxlifetime (and also Session.cookie_lifetime ), which sets a limit on how long PHP will allow sessions to last.

A solution is to check your php.ini. You can have this variable set: Session.gc_maxlifetime. By default, it is set to 1440. Only comment or delete it .

  • I will try to do this, to know if it worked I will have to wait a while to see if it does not kill the rsrsrs session.

  • Didn’t work :/

Browser other questions tagged

You are not signed in. Login or sign up in order to post.