Jump to content

Recommended Posts

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?
Link to comment
https://forums.phpfreaks.com/topic/5512-_session-information/
Share on other sites

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.
Link to comment
https://forums.phpfreaks.com/topic/5512-_session-information/#findComment-19723
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.