How do I stop Apache (wamp) from killing the session alone?

3

I developed an application with laravel and left it running in wamp , but after a while it ends up killing the user session, I wonder if there is any setting so that it stops doing it? Thanks!

    
asked by anonymous 01.09.2016 / 13:08

3 answers

2

You need to set the session.html a> and the probability of how much% of the time the trash of% 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 it 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 PHP directly 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(); 
    
01.09.2016 / 13:52
2

There are several types of settings you can do 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: Configuration Session

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

And a good read on PHP session: Link StackOverFlow

    
01.09.2016 / 13:36
0

Make sure 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.

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

    
01.09.2016 / 13:20