I have searched this forum but can't find any post that helps. Also, I don't understand the documentation at php.net.

My goal is to set the session_lifetime to 0, so it expires first when the browser is closed. Now it expires after about 10 minutes.

I have used the php Info to see the info on my server. But here I can see that the session.cookie_lifetime is allready set to Master Value 0. ???? Then why do it expire?
Someone recomended me to open the php.ini file so that I could change the settings myself, but I cant see this file in the directory (as shown in PHP Info), using FTP.

All of my pages start with:
<?
session_start();
header("Cache-control: private"); // IE 6 Fix.
?>

    By the way, in PHP Info, there are some more values:

    session.cache_expire : Value = 180
    session.gc_maxlifetime : Value = 1440

    Does this affect the session lifetime?
    And if so, how do I change them if I can't reach the php.ini file?

      Originally posted by Suspiria
      By the way, in PHP Info, there are some more values:

      session.cache_expire : Value = 180
      session.gc_maxlifetime : Value = 1440

      Does this affect the session lifetime?
      And if so, how do I change them if I can't reach the php.ini file?

      Yes. All of the session. configuration settings affect the handling of session data. What they are and what they do is covered in the [man]session[/man] section in the manual; and can be adjusted by editing php.ini httpd.conf, or using the [man]ini_set[/man] function.

        Thanks, but how do I change them if I can't reach the php.ini file?

          <?php
          ini_set("session.cache_expire", 180); 
          ?>
          

          Rinse and repeat as necessary 😃

            I cant find any file called httpd.conf or have any clue to what I should put inside it. Which ini_set should I use and where should I place it?
            Like this: ?
            <?
            session_start();
            ini_set('session.cookie_lifetime','0')
            header("Cache-control: private"); // IE 6 Fix.
            ?>

            As I said before, I don't understand much of the PHP manual...

              rw20,
              Thanks
              would this work:
              <?
              session_start();
              ini_set('session.cookie_lifetime','0') // Don't expire before the browser closes
              ini_set("session.cache_expire", 0); // Don't expire before the browser closes
              header("Cache-control: private"); // IE 6 Fix.
              ?>

                Make sure you set the params before you call session_start, but remember that you have to start the session before you output anything to the browser including headers...

                <?php
                ini_set('session.cookie_lifetime', 0);
                ini_set('session.cache_expire', 0);
                
                session_start();
                header("Cache-control: private");
                ?>
                
                  Write a Reply...