shadiadiph Posted May 9, 2010 Share Posted May 9, 2010 I am trying to fread a file that is 127,828 KB problem I am getting is I keep getting the error Fatal error: Allowed memory size of 262144000 bytes exhausted (tried to allocate 130809856 bytes) in /home/myvastpl/public_html/locationimport.php on line 52 I have already tried ini_set('memory_limit', '150M'); Any ideas? Quote Link to comment Share on other sites More sharing options...
JAY6390 Posted May 10, 2010 Share Posted May 10, 2010 Is there any reason why you need the whole of this file imported at once? what sort of file is it (ie what are you wanting to do with the data). If you change the size to a bigger memory limit it will probably work, but you shouldn't have to do that Quote Link to comment Share on other sites More sharing options...
shadiadiph Posted May 10, 2010 Author Share Posted May 10, 2010 it is the maxminds geocity lite csv file and i am trying to extract and turn it into an sql statement i already have it working with the geocountrylite but the citylite seems too big Quote Link to comment Share on other sites More sharing options...
JAY6390 Posted May 10, 2010 Share Posted May 10, 2010 You should run this in stages. If you're trying to create one big query then you need to remember that your memory usage will be the memory taken from the loaded file in addition to the memory usage of your query you are creating Personally I would use something like fgetcsv() for this, loading in line by line and processing the data. If you're creating a query to run perhaps running them in 20 sets of data batches at a time rather than all of them at once. Also be aware of the time limit set for scripts, you will need to set the max time limit to a higher level if you've got a lot of data like this to process Quote Link to comment Share on other sites More sharing options...
shadiadiph Posted May 14, 2010 Author Share Posted May 14, 2010 thanks jay solved it but i used fgets instead 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.