"James Butler" wrote:[color=blue]
> Running a CLI script that fopen’s a file, parses the lines into
> an
> array, checks the array entries against a few regular expression
> qualifiers (i.e. !eregi("bot",$entry)) and dump the good entries[/color]
into[color=blue]
> a MySQL db.
>
> The fopen’ed file is a 410MB text file with log entries
> formatted like
> a .CSV file ("" text qualifiers and comma separators).
>
> Running the script from a web browser in Windows98: Works fine,[/color]
except[color=blue]
> it stops about 1/10th of the way through (@~40MB).
>
> Running the script via CLI on the RH9 server: Works fine, except I[/color]
get[color=blue]
> "Terminated" about 3/4rs of the way through (@~300MB).
>
> Am I running into a memory useage issue or what? There’s no
> distinction between the last entry run successfully and the one[/color]
after[color=blue]
> that, in the log file dump, and everything goes into the db
> fine...until the script terminates.
>
> The Windows98 machine is running 512MB/PC133 DRAM with a 120GB HDD,
> connected via a full T1 to the RH9 server with the MySQL db.
>
> The RH9 server is a production server (I know...but I’m running
> out of
> options on where to process this behemoth text file!) running 1GB[/color]
RAM[color=blue]
> and twin 60GB HDDs.
>
> I will probably take what I have, trim the file to the remaining
> entries, and append to the db, however I would like to understand[/color]
why[color=blue]
> the script is cutting out.
>
> Thanks in advance for any illumination![/color]
I believe you can use fread and read it chunk at a time (and discard
what you have just read).
"Watch out when you use readfile to read big files ! Reading a file
of 6 meg will result in php using 6 megs of memory ! Php might stop
your script if you cross the memory limit. You’re better of using
fread when reading big files " from
http://ca3.php.net/manual/en/function.readfile.php
--
http://www.dbForumz.com/ This article was posted by author's request
Articles individually checked for conformance to usenet standards
Topic URL:
http://www.dbForumz.com/PHP-Memory-l...ict137374.html
Visit Topic URL to contact author (reg. req'd). Report abuse:
http://www.dbForumz.com/eform.php?p=459616