Reading large files via PHP?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm reading in a 66MB file into php so I can parse it and load it into a database.  However, it is taking a long time for php to read the file.  So long that the script times out.  I know about the ini_set("max_execution_time", 120) or whatever length I want to set the time out for the script, but my question is as follows.

Is it possible to read in a file and at the same time echo out a status of how far along the file has been read?

The code I have right now is below.  Just wondering if what I'm trying to do is possible and how to do it.

// set script timeout
ini_set("max_execution_time", 120);

// import file name
$log_file_name = "access_log.1";
echo "Reading access log!<br/>";
if (!$ac_arr = file("./$log_file_name")) {
	echo "Couldn't load access log!";
	die;
}

Thanks!

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux