UXerUIer
UXerUIer

Reputation: 2338

Increasing the database session duration with Symfony

My session for Symfony is being placed into the database as intended, however the issue is that the session lifetime is only 24 minutes. I'm attempting to increase this but it doesn't seem to be working.

My framework.yaml file:

session:
    enabled: true
    handler_id: Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler
    cookie_secure: 'auto'
    cookie_samesite: 'lax'
    cookie_lifetime: 604800

My services.yaml file:

services:
    Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler:
        arguments:
            - '%env(DATABASE_URL)%'

My security.yaml file:

firewalls:
        dev:
            pattern: ^/(_(profiler|wdt)|css|images|js)/
            security: false
        main:
            login_throttling:
                limiter: app.custom.limiter
            lazy: true
            provider: app_user_provider
            # https://symfony.com/doc/current/security/impersonating_user.html
            switch_user: true
            guard:
                authenticators:
                    - App\Security\LoginFormAuthenticator
            logout:
                path: logout
                # where to redirect after logout
                # target: app_any_route
            remember_me:
                secret:   ‘%kernel.secret%’
                lifetime: 604800 # 1 week in seconds

What am I doing wrong here?

Upvotes: 0

Views: 243

Answers (1)

Stephan Vierkant
Stephan Vierkant

Reputation: 10144

The default gc_maxlifetime in PHP is 1440 which explains the 24 minutes.

So update your session.gc_maxlifetime value.

Upvotes: 1

Related Questions