Opening large file problem - fopen

From: Date: Mon, 15 Dec 2003 23:48:35 +0000
Subject: Opening large file problem - fopen
Groups: php.general 
Request: Send a blank email to php-general+get-172765@lists.php.net to get a copy of this message
Hello Im having real problems working with large files in PHP. At the moment Im trying to parse an error_log file, and it works like a charm, except that the scipt stopps after parsing around 70.000 lines, or around 8MB of data. Im using this : $file = "error_log"; // 280MB file if($fp=fopen($file, "r+")) { while($line=trim(fgets($fp))) { // Do the business } } Surely this is not the way to work with e.g. a 280MB file. I solved the sollution by chopping the file into 7MB files, and adding a fileopen loop around the script above which solves my problem. But -> How do I parse the 280MB file all in 1 go? I have plenty of timeout and plenty of RAM in the php.ini file, so the problem isnt here. -- Kim Steinhaug --------------------------------------------------------------- There are 10 types of people when it comes to binary numbers: those who understand them, and those who don't. ---------------------------------------------------------------

« previous php.general (#172765) next »