I wanted to start a backup process. To do that user initiate the process/task from php script.
Here is the script
<?php
echo "starting";
shell_exec("whoami sleep 10 whoami > /dev/null 2>&1 &"); //background it.
//in place of backup start process i replaced with sleep just for testing
echo "Backup started, you will get mail once backup is done.";
?>
I tried to background the process but it seems like the php script is running for 10 seconds
. I don't want the php script to run for 10 sec(web browser loading till the end) so user don't have to wait for that long and echo response to end user as soon as I started any job.
What am I doing wrong here?
Question is unique
Another question is not at all with the solution(output to different place and background it). But here I used the solution already but the solution isn't working still. Not sure what am I doing wrong. So this should be considered as new question.