limitations on file pointer in php?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
liljester
Forum Contributor
Posts: 400
Joined: Tue May 20, 2003 4:49 pm

limitations on file pointer in php?

Post by liljester »

I have a logfile that i need to do a search on, so i whip out a php program to do it. the logfile is just a tad over 1GB (ouch!) with over 10 millions lines. The problem that i have is that for some reason fgets() stops reading at line 2,578,845... also, after we chopped the logfile up into smaller files, the exact same code works perfectly on the smaller files, if i search them one at a time.

thoughts, comments?
will
Forum Contributor
Posts: 120
Joined: Fri Jun 21, 2002 9:38 am
Location: Memphis, TN

Post by will »

i just can't imagine how it can be all that efficient to have a 1GB log file.... my only suggestion would be to look into logrotate. i don't know the exact limitations of fgets(), but logrotate would seem to make things more managable.

(for some reason, i can't find logrotate on freshmeat, but it shouldn't be hard to find on google)
User avatar
liljester
Forum Contributor
Posts: 400
Joined: Tue May 20, 2003 4:49 pm

Post by liljester »

i have a solution to the problem i had (we made lots of little files out of it), but i want an answer as to *why* php wont read the whole file =)
Post Reply