I have a PHP script which validates two variables, then passes them to a shell script. The script does work fine but when php runs shell_exec it waits until the shell script has finished running. The script script could take several minutes in which time PHP will timeout. How can I pass the two variables on without php waiting for the script to finish? Example... <?php shell_exec('/var/shell.sh $1 $2'); ?> Code (markup):
set_time_limit(5);// you may change that $output=@shell_exec('/var/shell.sh $1 $2'); set_time_limit(30);// default if($ouutput=NULL) echo "not executed"; else echo "executed"; Code (markup): is that work?
Try something like this: shell_exec("/var/shell.sh $1 $2 > /dev/null &"); PHP: This should work with exec, system, shell_exec, passthrough, etc...