Log in

View Full Version : gzipping and returning a file in PHP?


ggambett
07-15-2004, 07:28 AM
My server logs are big but compress well. I want to make a php script which will read the access log and return it as a .gz file. It shouldn't be too difficult but maybe any of you already has this?

ggambett
07-15-2004, 08:02 AM
Replying to my own post with freebies!

A couple of php scripts for you : http://www.MysteryStudio.com/misc/phputils.zip

bwmon.php opens and parses the Apache access logs from your server and produces a very simple bandwidth report. This can be used to monitor bandwidth in realtime and do load balancing, for example.

gzlog.php takes your Apache logs and gzips them to the same directory, for more efficient downloading later. This actually compresses any file, not only logs.

To use just edit the first couple of lines with the correct path to your log files.