php read large text file log

后端 未结 5 1735
时光说笑
时光说笑 2020-12-10 22:04

I have a text log file, about 600 MB.

I want to read it using php and display the data on a html page, but I only need the last 18 lines that were added each time I

5条回答
  •  情书的邮戳
    2020-12-10 22:16

    For the record, had the same problem and tried every solution here.

    Turns out Dagon's popen "tac $filename" way is the fastest and the one with the lowest memory and CPU loads.

    Tested with a 2Gb log-file reading 500, 1000 and 2000 lines each time. Smooth. Thank you.

提交回复
热议问题