My question may be a bit complicated.
This is my scenario:
I want to start the mjpg streamer using php. My php script is:
<?php
$output = shell_exec("sh /var/www/html/shellstart.sh");
echo "<pre>$output</pre>";
header("Location: ../index.php");
?>
It works fine in starting the script. The problem is that the script
shellstart.sh:
LD_LIBRARY_PATH=/opt/mjpg-streamer/mjpg-streamer-experimental/ /opt/mjpg-streamer/mjpg-streamer-experime $
starts a process and the header() function is never called, because it never leaves the script. So I am looking for a method to start the script, keep it running but return to the php script and call the header() function.
I already tried
trap "exit" SIGINT
and
nohup LD_LIBRARY_PATH=/opt/mjpg-streamer/mjpg-streamer-experimental/ /opt/mjpg-streamer/mjpg-streamer-experime$
also I tried $ disown. But when using nohup or $ disown the script won't even start the process.
I appreciate any help! Thanks in advance.