How can I read a big file in php (csv file) line by line to avoid getting out of memory? At the moment, I have this :
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 72 bytes)
I'm nearly sure my php reads lines one by one :
$i = 0;
$source = fopen('falkcsvutf.csv', 'r') or die("Problem open file");
while (($data = fgetcsv($source, 0, ";")) !== FALSE && $i < 10)
{
echo $data[1];
$i++;
}
fclose($source);
$i < 10 is there only to limit in debugging...
I have the feeling php things there is only one line in my csv, however, when I open the file in sublime text, I see all the lines (with line numbering)
The file is a Excel file, saved to CSV, then converted to utf8 with iconv function.
any idea?