in reply to Using fork() with a CGI program

Unless you want to embark on the strange and perilous road of trying to implement server-push, you are stuck with the default http environment, which is, client pull. What that means is you can only send stuff to the client when it asks for it. Theres no way, short of server-push, to magically send data to a client unless it requests said data.

In this case the best bet is to probably try to emulate server push by having three 'scripts' (or modes or whatever).

Mode 1 simply starts the process then sends the user to mode 2.

Mode 2 checks if the child process is done. If it's done, it redirects the client to mode 3, other wise it simply says "wait 3 seconds and ask me again". You can acheive this "wait x seconds and ask me again" a number of ways, most of them involving the refresh header. For example: <META HTTP-EQUIV="Refresh" CONTENT="10; URL=url"> in the html. Or javascript or an actual http refresh header.

Mode 3 displays the results of the child jobs.