Try using the set_time_limit() method to extend the scripts life (the default TTL is 30 seconds BTW). The method accepts an integer as an argument which specifies the TTL in seconds.
@set_time_limit(10000);
For example, this sets your script execution maximum to 10,000 second, or about 2.8 hours. Regarding output handlers, if you're running PHP 4.0.5 or later which zLib support you might want to look into the ob_gzhandler() method. Basically it checks if the requesting browser supports compressed content and then sends the output buffer using either gzip or deflate. It can be used by placing the following line above all output in your scripts:
ob_start("ob_gzhandler");
HTH,
Geoff A. Virgo