How to increase session expire or Logout time?



  • How to increase session expire or Logout time?



  • @Rosa-A-Hancock

    By default session expire time is around 10 min means if you are inactive on site from last 10 min it will automatically logout after 10 minute of inactivity.

    If you wish to change it follow below solution.

    Locate path in your project config->packages->framework.yaml

    You will basically store the sessions in the /var/sessions/ directory and that's it, the lifetime option will work again. You can do this quickly modifying your framework.yaml file in the session block like this:

    session:
          handler_id: session.handler.native_file
          save_path: '%kernel.project_dir%/var/sessions/%kernel.environment%'
          # 2 Days lifetime (172800 seconds)
          cookie_lifetime: 172800
          cookie_secure: 'auto'
          cookie_samesite: 'lax'

    Most probably it should will work for you.

    And after saving framework.yaml file you should clear your project cache by below command:

    php bin/console c:c


Log in to reply