Jump to content


$_SESSION Information

  • Please log in to reply
1 reply to this topic

#1 lead2gold

  • Members
  • PipPipPip
  • Advanced Member
  • 164 posts
  • LocationOttawa, On

Posted 22 March 2006 - 04:51 PM

What is the limit as to how much you can store in a $_SESSION variable once a session has been started?
I havn't hit the limit yet (whatever that is), but i do tend to store information i should probably reconsider doing.

Currently i store it as:
$_SESSION['user_id'] = <Currently logged in Users RIN #>
$_SESSION['axs_id'] = <Access Level >

now the above i consider pretty standard... it's whats below that has me worried.
I allow the expanding and collapsing of tables by clicking a {+/-} listing information below.. ie:

$_SESSION['user_list']['Admin']= {0/1}
$_SESSION['user_list']['Reg']= {0/1}
$_SESSION['user_list']['Guest']= {0/1}
$_SESSION['team_list']['<team name here>']= {0/1}
$_SESSION['team_list']['<team name here>']= {0/1}
$_SESSION['team_list']['<team name here>']= {0/1}
.... etc

With enough expand/collapse pages and having a user visit each one (thus populating alot of the $_SESSION variable with memory tracking)... could i potentially exceed the Session Limit?

#2 redbullmarky

  • Staff Alumni
  • Advanced Member
  • 2,863 posts
  • LocationBedfordshire, England

Posted 22 March 2006 - 07:26 PM

nothing in computing is limitless, however i have (so far) found no reason to worry about the size of session data. storing the odd character here, number there, etc,will not really amount to enough to cause major problems.

when a session is started, a file is created on the server which holds your info. when your session expires (or you close your browser) the session file ceases to exist.

if i'm honest, i'm not sure if there is any 'set' limit on session size. if their isn't, then the size would be determined by how much space is actually used by all of the session files on the server.

if youre that worried about how much you store, then simply look through your code and see if you are storing info that NEEDS to be stored (ie, preloading an entire database wouldnt be advisable). user info, users settings, etc are fine. but entire lists of teams and team data would probably be better on your server if they were read from the database as required, rather than stored.

"you have to keep pissing in the wind to learn how to keep your shoes dry..."

I say old chap, that is rather amusing!

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users