incubus Posted October 13, 2007 Share Posted October 13, 2007 Hi all - newbie here. I have an HTML form and am storing the values the user enters in session variables so they can persist between pages (the form is over 3 html pages). All in all, there will be around 45 values stored like so: $myVar = $_POST['myVar']; $_SESSION(myVar) = $myVar; Will this have a detrimental effect on performance? How much memory is available to the session to store variables? Would it make a difference if there were lots of users doing the same thing? Would I be better putting all the form values into a large array, and then just storing the array in the session? That is: $myArray = array(); $myArray[0] = $_POST['myVar']; $_SESSION(myArray) = $myArray; Hope this makes sense, thanks for looking. Quote Link to comment https://forums.phpfreaks.com/topic/73096-solved-memory-used-by-session-variables/ Share on other sites More sharing options...
incubus Posted October 14, 2007 Author Share Posted October 14, 2007 Anyone any clues about this? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/73096-solved-memory-used-by-session-variables/#findComment-369243 Share on other sites More sharing options...
trq Posted October 14, 2007 Share Posted October 14, 2007 Session values are stored on disk, not in memory. generally speaking you need'nt worry about such things too much. Quote Link to comment https://forums.phpfreaks.com/topic/73096-solved-memory-used-by-session-variables/#findComment-369249 Share on other sites More sharing options...
MadTechie Posted October 14, 2007 Share Posted October 14, 2007 if you wanted to you could recompiling PHP using the shared memory module for sessions, or use a RAM Disk. Enable this with "configure -–with-mm" then re-compile PHP, and set session.save_handler=mm in php.ini. Quote Link to comment https://forums.phpfreaks.com/topic/73096-solved-memory-used-by-session-variables/#findComment-369251 Share on other sites More sharing options...
incubus Posted October 14, 2007 Author Share Posted October 14, 2007 Session values are stored on disk, not in memory. generally speaking you need'nt worry about such things too much. Great, thanks. Just from a best practise point of view, would it make a difference if the variables were stored in an array which was then itself stored in the session? Quote Link to comment https://forums.phpfreaks.com/topic/73096-solved-memory-used-by-session-variables/#findComment-369253 Share on other sites More sharing options...
trq Posted October 14, 2007 Share Posted October 14, 2007 would it make a difference It would, but once again, I think the difference would be that minimal that its not worth worrying about. Quote Link to comment https://forums.phpfreaks.com/topic/73096-solved-memory-used-by-session-variables/#findComment-369260 Share on other sites More sharing options...
incubus Posted October 14, 2007 Author Share Posted October 14, 2007 Thanks all. Hope to be able to help some of you out in the future. Quote Link to comment https://forums.phpfreaks.com/topic/73096-solved-memory-used-by-session-variables/#findComment-369344 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.