|
Posted by MrBiggles on 02/11/06 18:49
Here's the sitch:
I read in a csv file with 60000 lines (20 fields per record), and store
the data to a local array. The file is read in and stored just fine and
pretty quick.
Now, if I try to assign that array to a session variable it chokes.
e.g. create array and load each element with a row from the file (btw,
each row is an array as well, using fgetcsv()). When local array is
loaded, I assign to session var as so:
$_SESSION['mydata'] = localArray;
What happens is the server will sit there and churn for a long time. CPU
goes to 99% use and memory use explodes on the apache thread. It will
keep churning a looong time, so long that I had to stop the server to
make it quit. This happens on my windows server as well as fedoracore4
server.
I've tried these variations all with the same results:
- store reference to array in session var (although since it's an array,
I think it makes no difference). e.g. $_SESSION['mydata'] =& myArray;
- read the file directly into a sesson var, instead of creating a local
array first. e.g. $_SESSION['mydata'][] = $row; (grabbing one row at a
time from file)
Same thing always happens.
Anybody have any insight into storing large arrays as session vars? Is
it bad practice? Can it be done? What's the scoop?
Any help appreciated!
Thanks
B
[Back to original message]
|