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.
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
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.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)