ballhogjoni Posted May 30, 2013 Share Posted May 30, 2013 (edited) Im trying to loop through a 145mb csv file but I keep getting Fatal error: Allowed memory size of xxxxxxxxxx bytes exhausted (tried to allocate 71 bytes) I've tried setting the memory limit to 512m, 1024m, 2048m while (($data = fgetcsv($handle, 0, ",")) !== FALSE) { if (in_array($data[0], array( 1, 4, 6, 40, 50, 136, 451, 933, 1529, 2006, 2155, 2271, 2603, 2640, 3173, 3619, 3789, 4479 ))) { continue; } $in_data[] = $data; } Whats the best way to do this? What am I not understanding here? Any examples would help. Edited May 30, 2013 by ballhogjoni Quote Link to comment Share on other sites More sharing options...
requinix Posted May 30, 2013 Share Posted May 30, 2013 Looks like you're trying to store most of the file in memory. You really have to do that? I bet you don't. And did you restart after applying the memory_limit changes? Quote Link to comment 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.