fgetcsv freezes after 26,xxx records
Moderator: General Moderators
- caseymanus
- Forum Commoner
- Posts: 34
- Joined: Wed Nov 20, 2002 10:32 pm
- Contact:
fgetcsv freezes after 26,xxx records
I am parsing a large CSV, but it stops parsing after 26,xxx lines out of about 168,xxx and CPU Utilization spikes. Its like there is a memory leak or something. Anyone have any thoughts, and by the way I have increased my script time out so that is not the issue.
- caseymanus
- Forum Commoner
- Posts: 34
- Joined: Wed Nov 20, 2002 10:32 pm
- Contact:
- caseymanus
- Forum Commoner
- Posts: 34
- Joined: Wed Nov 20, 2002 10:32 pm
- Contact:
There turned out to be a bug in fgetcsv that caused a lock up when trying to parse multible double-quotes. This was supposedly fixed but I never got it to work. Instead I read the line into an array then used explode() to process it....something like this
Just wanted to document this if anyone else ran into the problem
Code: Select all
while ($line = fgets($fp, 3000)){ //read each line
$data = explode("|", $line); //create the array
//do some more code}