phphttp-headersgzipsuphp

Script timed out before returning headers: script.php, refererer http://


One of my applications is rendering a huge PDF-file. After adjusting some settings at my PHP I noticed suPHP throws an error 500-page after 5 minutes of running the script. However, I don't want to disable the maximum time since it's an webserver with multiple customers on it. Now somebody told me an possible solution:

Turn off GZIP compression on the script

When script running, add additional headers so PHP knows it has to process the whole script

Flush output after rendering the PDF

However, I've never done such a thing and I really have no idea how to accomplish this. Can someone point me in the right direction?


Solution

  • Basically the somebody told you to

    For creating pdf and storing into buffer look into output buffering - ob_start() , ob_flush() functions

    For sending the contents of the buffer , this answer should help.

    I am not sure how/if turning off gzip compression will help, but it can be done using the ini_set methods.