Results 1 to 3 of 3

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

  1. #1
    Join Date
    Feb 2006

    Is there a session size limit for session data?

    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
    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.
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

  3. #3
    Join Date
    Feb 2003
    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