Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maximum size of a PHP session

What is the maximum size that can be stored in a PHP session?

like image 478
Roch Avatar asked Jan 10 '11 18:01

Roch


People also ask

How much data can session store?

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.

How many sessions can PHP handle?

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.

How big can a session variable be?

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).

How long is a PHP session?

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().


1 Answers

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)

like image 195
Rudu Avatar answered Oct 06 '22 07:10

Rudu