Using PHP $_SESSION variable to store large amonts of data

后端 未结 2 874
醉梦人生
醉梦人生 2020-12-12 06:07

I\'m currently storing a fair amount of data in the $_SESSION variable. I\'m doing this so I don\'t need to keep accessing the database.

Should I be worried about me

2条回答
  •  天命终不由人
    2020-12-12 06:41

    Should I be worried about memory issues on a shared server?

    Yes - session data is loaded into the script's memory on every request. Hence, you are at risk of breaking the individual per-script memory limit. Even if you don't hit the limit, this is really inefficient.

    Accessing data from the database on demand is much better.

提交回复
热议问题