On Fri, 02 Jan 2009 11:01:20 Matthew White wrote: > How are you using fread? > > Something like > > $contents = fread($handle, filesize($filename));
Yes, like that. > Will read the whole thing into memory, which is not something you > really want to do as previously noted Well, the system does have 4Gb and I would upgrade it to 8Gb if necessary, but even when I allow PHP to use 2.5Gb or even 3Gb of RAM, it still barfs. > Can you tell us a little more about the nature of the file? text file. > If its textual rows, with the \n character, then you'll be wanting to > use fgets() to read one line at a time. > > If its xml, then look at the xml parsing functions. Even when I use fgets() I still get the same error message: Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 2023545829 bytes) in /www/scan.php on line 145 This file is XML though I don't want specific XML programming if I can avoid it. It should work fine on XML files to retrieve the data, as it works on haphazard non-XML files. --~--~---------~--~----~------------~-------~--~----~ NZ PHP Users Group: http://groups.google.com/group/nzphpug To post, send email to nzphpug@googlegroups.com To unsubscribe, send email to nzphpug+unsubscr...@googlegroups.com -~----------~----~----~----~------~----~------~--~---