Try using popen () instead of exec ().
This hack will work on any standard PHP installation, even on Windows; no additional libraries are required. Yo cannot really control all aspects of the processes that you create in this way, but sometimes this is enough:
$p1 = popen("/bin/bash ./some_shell_script.sh argument_1","r"); $p2 = popen("/bin/bash ./some_other_shell_script.sh argument_2","r"); $p2 = popen("/bin/bash ./yet_other_shell_script.sh argument_3","r");
The three shell scripts generated will run simultaneously, and unless you do pclose ($ p1) (or $ p2 or $ p3) or try to read from any of these channels, they will not block your PHP execution.
When you finish with your other stuff (what you are doing with your PHP script), you can call pclose () in the pipes and this will pause your script until you run pclosing ends. Then your script can do something else.
Note that your PHP will not complete or die () until these scripts end. Reaching the end of the script or calling die () will keep it waiting.
source share