Your post is a little short on detail.
Are you relying on the CGI script or the PHP script to set headers?
Perhaps you have to parse the headers returned by the CGI script and re-issue them in your PHP script? (or at least strip them to prevent them from being issued twice.) If you are seeing headers in your output when you access the page in a browser, this is probably the case.
I've used exec() to include the output of a perl script in my PHP code. Never had any real problems with it.
Contact me (
[email protected]) if you want a second pair of eyes to double check what you're doing.