Professional Web Applications Themes

Session+cookies expiration - PHP Development

Hi, I just started to use/learn php session and cookies. Everything looks fine, I took a quick look at the php session man pages but there's two little things that I can't figure out completely. 1- A simple page to see what happens behind the scene: <? session_start(); $_SESSION['TEST'] = "This is a test"; phpinfo(); ?> Session config looks like this: session.cache_expire = 30 session.cookie_lifetime = 1800 session.gc_maxlifetime = 1440 phpinfo() show the following HTTP Response Headers : Set-Cookie: PHPSESSID=sgkddlmuepiksd48pq1tmj38s0; expires=Sat, 21-May-2005 10:38:41 GMT; path=/ [Which is ok ... cookie will expire in 30 minutes (1800 seconds)] EXPIRES: Thu, 19 ...

  1. #1

    Default Session+cookies expiration

    Hi,
    I just started to use/learn php session and cookies. Everything looks fine,
    I took a quick look at the php session man pages but there's two little
    things that I can't figure out completely.

    1- A simple page to see what happens behind the scene:
    <?
    session_start();
    $_SESSION['TEST'] = "This is a test";
    phpinfo();
    ?>

    Session config looks like this:
    session.cache_expire = 30
    session.cookie_lifetime = 1800
    session.gc_maxlifetime = 1440

    phpinfo() show the following HTTP Response Headers :
    Set-Cookie: PHPSESSID=sgkddlmuepiksd48pq1tmj38s0; expires=Sat, 21-May-2005
    10:38:41 GMT; path=/
    [Which is ok ... cookie will expire in 30 minutes (1800 seconds)]
    EXPIRES: Thu, 19 Nov 1981 08:52:00 GMT
    This is the one I don't understand, what is it, where does this value come
    from? And it's always the same exact date/time. ?!?

    2- The session files in D:\TEMP are not removed. I thought that those files
    would be removed after some time (maybe I'm just not patient enough).

    If anyone could tell more about this or point me to doentation relevant
    to one of these questions I would appreciate.

    Thanks
    Dae



    Daedalus.OS Guest

  2. #2

    Default Re: Session+cookies expiration

    Daedalus.OS wrote: 

    This field controls the caching behaviour of the browser. The value PHP
    sends by default (19th of Nov, 1981) ensures that the page will not be
    cached by the browser and will be retrieved from the server each time it's
    requested.

    More info: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.21


    JW



    Janwillem Guest

  3. #3

    Default Re: Session+cookies expiration

    Thanks a lot for the rfc link ... I wasn't shure if it was related to the
    page or to cookies.

    What about the session file in the temp folder ... isn't it supposed to be
    removed automatically after a while ? And if so, is this time interval
    configurable ? I thought it was the garbage collector but maybe I'm wrong.
    Maybe it's another only-on-windows issue ... I'll try it on my freebsd box.

    Dae


    "Janwillem Borleffs" <com> wrote in message
    news:428fb569$0$35662$euronet.nl... 
    >
    > This field controls the caching behaviour of the browser. The value PHP
    > sends by default (19th of Nov, 1981) ensures that the page will not be
    > cached by the browser and will be retrieved from the server each time it's
    > requested.
    >
    > More info: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.21
    >
    >
    > JW
    >
    >
    >[/ref]


    Daedalus.OS Guest

  4. #4

    Default Re: Session+cookies expiration

    Daedalus.OS wrote: 

    It's very common that session files aren't cleaned up by PHP. Personally I
    use a cronjob to take care of this once a week.


    JW



    Janwillem Guest

  5. #5

    Default Re: Session+cookies expiration

    Janwillem Borleffs wrote:
    <snip>
     
    Personally I 


    Mostly it has to do with your gc setting
    <http://in.php.net/session#ini.session.gc-divisor> Since, you'll be the
    only person who make requests, it will be hard for the gc to be called.

    --
    <?php echo 'Just another PHP saint'; ?>
    Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/

    R. Guest

  6. #6

    Default Re: Session+cookies expiration

    Thanks a lot guys ...

    Dae


    "R. Rajesh Jeba Anbiah" <com> wrote in message
    news:googlegroups.com... 
    > Personally I 
    >
    >
    > Mostly it has to do with your gc setting
    > <http://in.php.net/session#ini.session.gc-divisor> Since, you'll be the
    > only person who make requests, it will be hard for the gc to be called.
    >
    > --
    > <?php echo 'Just another PHP saint'; ?>
    > Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/
    >[/ref]


    Daedalus.OS Guest

Similar Threads

  1. Help with Session variable expiration
    By Skotopia in forum Macromedia ColdFusion
    Replies: 12
    Last Post: September 12th, 04:00 PM
  2. Cookies Vs Session
    By theDude28 in forum Macromedia ColdFusion
    Replies: 5
    Last Post: May 10th, 09:01 PM
  3. Session expiration and authentication
    By Marcio Kleemann in forum ASP.NET Security
    Replies: 2
    Last Post: May 24th, 10:57 PM
  4. Help with setting expiration dates on COOKIES
    By Rickey Tom in forum ASP.NET General
    Replies: 4
    Last Post: July 29th, 12:46 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139