PHP export to CSV dies after 10000 records
I want to export my result set, of about 26000 records, into csv.
It's not working when it goes past the 10000开发者_开发问答 range.
Even after I have changed the max_execution_time
to 60 in php.ini.
My code looks like this:
header("Content-type: application/vnd.ms-excel");
header("Content-disposition: csv" . date("Y-m-d") . ".csv");
header( "Content-disposition: filename=".$filename.".csv");
print "$header\n$output";
Can anyone give me a heads up to where I'm going wrong?
Why storing everything into $output? Output each line as you read it from the database, no need to use up memory to store everything just for output.
And avoid fetchAll and similar methods... output each row...
精彩评论