Hi
I've had similar problems - and I remember I played with nohup and redirecting output. I got it to work somehow, but it was not stable. I think it's because the command's output is supposed to go to the browser, and that can be tricky when the browser is gone.
But I found one solution in the end. Instead of outputting progress to stdout, I just output the progress to a text file. To get the process to run independent of the web-server (so you can even restart the webserver while the script is running), I used the at command.
PHP Code:
$cmd = "/usr/bin/sudo -u myuser script.sh &>/dev/null";
$cmd = "echo ".EscapeShellArg($cmd)." | at now";
exec($cmd);
Then I just read the progress file and output it to the browser. The client can then reload the page to see how it's going, or you could make it auto-reload with a meta tag every now and then.
You probably have to add www-data to /etc/at.allow or remove it from /etc/at.deny for it to work.