Use this code:
<?php exec('nohup /usr/bin/my-command > /dev/null 2>&1 &'); ?>
This expands the subprocess in the background and writes all the output to /dev/null . Thus, PHP continues to execute the script as if there would be no output that it should wait.
source share