Professional Web Applications Themes

Session info stored on server - PHP Development

What's actually stored on the server when using sessions? I've built a content management system on a commercial host, PHP 4.3.2, Apache 1.3.28, and use session_save_path() to specify a directory. When someone logs in, I check the username and password against the database, and save username as a session variable -- $valid_user = $username; session_register("valid_user"); If I examine the directory specified by session_save_path(), I see something like "sess_4f5d...0367". Where's the session variable "valid_user"? Is it an array element of "sess_whatever", or are session variables stored in memory with only the ID stored on the server? A related question -- I ...

  1. #1

    Default Session info stored on server

    What's actually stored on the server when using sessions?

    I've built a content management system on a commercial host, PHP 4.3.2,
    Apache 1.3.28, and use session_save_path() to specify a directory. When
    someone logs in, I check the username and password against the database, and
    save username as a session variable -- $valid_user = $username;
    session_register("valid_user"); If I examine the directory specified by
    session_save_path(), I see something like "sess_4f5d...0367". Where's the
    session variable "valid_user"? Is it an array element of "sess_whatever", or
    are session variables stored in memory with only the ID stored on the
    server?

    A related question -- I thought that by specifying a directory with
    session_save_path(), the session data would not be subject to garbage
    collection. However, when I examine the directory specified, I don't see any
    creation dates more than 24 hours old, and I know there have been instances
    where the Mac OS X Entourage/Internet Explorer bug have caused sessions to
    fail, so the user never logged out, and session_unregister() and
    session_destroy() were never called for those sessions. Why aren't those
    sessions still listed in the sessions directory?

    Thanks for any insights.

    --
    Lowell Allen
    Lowell Guest

  2. #2

    Default Re: [PHP] Session info stored on server

    Lowell Allen wrote:
     
    Open sess_4f5d...0367 in any text editor and you will see your variable
    there.
     
    session_start() runs garbage collector in current session save path
    directory. The plus is you are not affected by other virtual hosts on
    the same server.
     
    Marek Guest

  3. #3

    Default Re: [PHP] Session info stored on server

    >> What's actually stored on the server when using sessions? [/ref]
     

    I can't. I'm unable to open or download or change the permissions. Is it an
    array?
     [/ref]
     

    So if I want to create sessions that last indefinitely (as least as far as
    the server is concerned), do I need to write my own session functions that
    use a database to store the session ID?

    --
    Lowell Allen
    Lowell Guest

  4. #4

    Default Re: [PHP] Session info stored on server

    >> Open sess_4f5d...0367 in any text editor and you will see your variable 
    >
    >I can't. I'm unable to open or download or change the permissions. Is it
    >an array?[/ref]

    A serialized array, yes.


    ---------------------------------------------------------------------
    michal migurski- contact info and pgp key:
    sf/ca http://mike.teczno.com/contact.html
    Mike Guest

Similar Threads

  1. Replies: 1
    Last Post: July 14th, 06:36 PM
  2. Replies: 0
    Last Post: August 13th, 04:02 PM
  3. Replies: 0
    Last Post: August 13th, 03:10 PM
  4. Replies: 0
    Last Post: August 13th, 03:06 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