How can i set the session timeout in htaccess? Thanks 🙂

    php_value session.cookie_lifetime 3600
    php_value session.gc_maxlifetime 3600
    

    (The values are seconds.)

      Thanks, i have added this though the session expires within 20min? I have changed the values to 99999999

        You might want to try the following to see if the .htaccess values are "taking":

        <?php
        printf("cookie: %s, gc: %s", ini_get('session.cookie_lifetime'), ini_get('session.gc_maxlifetime'));
        

          I get the values that are stored in the .htaccess

            Only thing I can think of would be if other scripts are running on that server with different gc_maxlifetime values, and which are using the same session data directory. If so, then whenever one of them runs, its call to session_start() would trigger the gc (garbage collection) process on that directory using that script's lifetime value. If that could possibly be the case, then you'll want to set up your own session data directory and add that to your .htaccess file via the session.save_path setting.

              Write a Reply...