PHP: Hypertext Preprocessor This little PHP code snippet could come in handy for those in a need to display most recent entries in a considerably heavy text file, e.g. Apache log.

In UNIX environments there’s tail, that does the trick of displaying last few lines in a text file, e.g.

tail -n 10 /home/clients/tekkie.flashbit.net/logs/default-error.log

for the last 10 lines of Apache error log. On the remote server this kind of tool is the subject of SSH access or the possibility of using proc_open or exec functions of PHP to call tail. Mostly, esp. on the virtual servers, this is not the case.

The above reasoning is exactly why this code is a handy tool:

Download the code.