dcsimg
www.webdeveloper.com
Results 1 to 3 of 3

Thread: Is there a session size limit for session data?

  1. #1
    Join Date
    Feb 2006
    Posts
    54

    Is there a session size limit for session data?

    Hi.
    I'm working at a quiz project with PHP5 . The questions are gonna be spread over multiple pages.
    I'm thinking to create a quiz object having a variabile storing an array of question objects. The question object will contain the question text, answers, correct answers etc. So the quiz obj. will have let's say 30 instances of question obj. The quiz obj. is stored in session data. The questions are gonna be randomized, so I want to avoid reading them for a second time from database.
    As i analyzed the problem it's gonna be more convenient, easy (and fast i guess) to work with session data.
    Now having no experience with php i don't know if there is a limit i can store in a session variabile.

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    19,633
    I'm not aware of a logical limit imposed by PHP. The two physical limits would be memory during runtime and disk space allocated to the directory where PHP stores session data.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  3. #3
    Join Date
    Feb 2003
    Posts
    2,745
    by default, there is no limit other than physical disk (or partition) size, though you can write code to limit it and modifiy in your php.ini.

    It isn't a good idea to cram too much into session as the entire file (remember sessions are file based, not memory based) is read every time and you can actually hurt performace by putting too much into session.

    That said, you are probably fine putting your quiz into session, and that's a good way to do it in most instances.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles