PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, February 16, 2022

[FIXED] Increasing the database session duration with Symfony

 February 16, 2022     session, symfony     No comments   

Issue

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?


Solution

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

So update your session.gc_maxlifetime value.



Answered By - Stephan Vierkant
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing