See Watching long processes through CGI - merlyn tells it much better than I can.
In reply to Re: Long running CGI script by Corion in thread Long running CGI script by ndnalibi