how to set session timeout in php.ini file?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • impin
    New Member
    • Jul 2010
    • 127

    how to set session timeout in php.ini file?

    in php.ini file...
    Code:
    session.gc_maxlifetime = 1440
    if i change the value it doesnt work... i set the
    Code:
    session.gc_maxlifetime = 3600
    but it doesnt work...
    how to set session timeout to one hour?
    plz help...
  • Shenno
    New Member
    • Sep 2010
    • 59

    #2
    // php.ini setting required for session timeout.

    ini_set(‘sessio n.gc_maxlifetim e’,60*60);
    ini_set(‘sessio n.gc_probabilit y’,1);
    ini_set(‘sessio n.gc_divisor’,1 );


    u can use ini_get function to see if your changes has been saved.

    hope this helps.

    Comment

    • Shenno
      New Member
      • Sep 2010
      • 59

      #3
      // php.ini setting required for session timeout.

      ini_set(‘sessio n.gc_maxlifetim e’,60*60);
      ini_set(‘sessio n.gc_probabilit y’,1);
      ini_set(‘sessio n.gc_divisor’,1 );


      u can use ini_get function to see if your changes has been saved.

      hope this helps.

      Comment

      • impin
        New Member
        • Jul 2010
        • 127

        #4
        where i put this in my php code or in php.ini file?

        Comment

        • Shenno
          New Member
          • Sep 2010
          • 59

          #5
          if u have access to php.ini file, search the for

          session.gc_maxl ifetime
          session.gc_prob ability
          session.gc_divi sor


          and set there values as mentioned in the functions

          other thing i've remembered may be the line are comments. remove # before the line

          Comment

          • Msohail
            New Member
            • Jun 2016
            • 1

            #6
            i want to set session time out 5 mint....
            how to change
            ini_set(‘sessio n.gc_maxlifetim e’,60*60);
            ini_set(‘sessio n.gc_probabilit y’,1);
            ini_set(‘sessio n.gc_divisor’,1 );

            according to my need

            Comment

            • praveenvt
              New Member
              • Dec 2017
              • 1

              #7
              ini_set(‘sessio n.gc_maxlifetim e’,60*5);
              for 5 minutes.

              value is in seconds. you can also give like this,
              ini_set(‘sessio n.gc_maxlifetim e’,300);

              Note: Restart Apache once done the modification. Then only it will reflect.

              Comment

              Working...