1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

What is the character limit of php Session variable?

Discussion in 'PHP' started by Ari_Gold, Jun 16, 2011.

  1. #1
    I'm working on a project that dynamically creates and modifies a Session variable that I use in a MYSQL query for the duration of a users visit. This Session variable can get lengthy, so does anyone know what the character limit is?

    Thanks ;)
     
    Ari_Gold, Jun 16, 2011 IP
  2. pr-biztech

    pr-biztech Peon

    Messages:
    76
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Yes I am also looking for the same thing. Can WP do that on its own or I have to strip out some content manually with php code?
     
    pr-biztech, Jun 17, 2011 IP
  3. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #3
    It can hold quite a bit. How much data are you talking about? The session data is stored on the server so not a lot of information needs to be passed to and from the user's browser which increases speed. You can store a lot in a session variable if you need to.
     
    jestep, Jun 17, 2011 IP
    Ari_Gold likes this.
  4. Ari_Gold

    Ari_Gold Peon

    Messages:
    21
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Thanks for the reply. This information is very useful.
     
    Ari_Gold, Jun 17, 2011 IP
  5. pr-biztech

    pr-biztech Peon

    Messages:
    76
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Hey really it is good thing for me because it really works good and now I am free from my problem.
     
    pr-biztech, Jun 21, 2011 IP
  6. sinha.sidhi

    sinha.sidhi Peon

    Messages:
    50
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    We all now that upon calling session_start(), it will create a file and in this file the session variables that you assigned will be stored. My question is how big can a session file can be? is there a limit or maximum file size for a session file?
     
    sinha.sidhi, Jun 21, 2011 IP
  7. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #7
    It would be dependent on the directory size that is available on the server. Normally, sessions are stores in a tmp or other session specific directory. This can often grow, but depending on how the server is setup it may be on its own partition which would have a maximum size.

    You can get the session path in phpinfo, or with: http://php.net/manual/en/function.session-save-path.php

    If you understand how the server file system is setup, you should be able to easily guess how much space you have available. Also, old sessions are periodically cleared out so you don't need to assume days or even hours of session information on the server.
     
    jestep, Jun 21, 2011 IP
  8. tks

    tks Well-Known Member

    Messages:
    89
    Likes Received:
    4
    Best Answers:
    1
    Trophy Points:
    108
    #8
    tks, Jun 21, 2011 IP