cakephp - PHP memory usage for fopen in append mode -


i have custom cakephp shopping cart application i’m trying create csv file contains row of data each transaction. i’m running memory problems when having php create csv file @ once compiling relevant data in mysql databse. csv file contains 200 rows of data.

alternatively, i’ve considered creating csv in piecemeal process appending row of data file every time transaction made using: fopen($mfile.csv, 'a');

my developers saying still run memory issues approach when csv file gets large php read whole file memory. case? when using append mode php attempt read whole file memory? if so, can recommend better approach?

thanks in advance, ben

i ran following script few minutes, , generated 1.4gb file, on php memory limit. read file without issue. if running memory issues else causing problem.

$fp = fopen("big_file.csv","a");  for($i = 0; $i < 100000000; $i++) {     fputcsv($fp , array("val1","val2","val3","val4","val5","val6","val7","val8","val9")); } 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -