What is the maximum size that can be stored in a PHP session?
Session storage can also accommodate a huge amount of data. Most browsers, including Chrome and Firefox, can store about 10 MBs of data in session storage.
1000+ sessions can still be perfectly handled by standard PHP file based sessions. If you notice that is getting a problem, you can exchange the session backend easily. There are pluggable session handlers for memcached or other memory or database based storage systems.
As @Thariama said, there's no limit on the number of variables; also, there's no limit on the amount of data you can store in a session (I've seen sessions tens of MB in size).
By default, a session lasts until the user closes his browser. This option can be changed in the php. ini file on the web server by changing the 0 in session. cookie_lifetime = 0 to the number of seconds you want the session to last or by using session_set_cookie_params().
You can store as much data as you like within in sessions. All sessions are stored on the server. The only limits you can reach is the maximum memory a script can consume at one time, which by default is 128MB.
(Similar answers: Ideal PHP Session Size? - some useful comments)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With