in reply to problems with exec command

exec never returns.

Maybe you want system, or maybe you want to print your HTML and then exec?

Maybe you want to watch a long running process through CGI?