Skip to content

Instantly share code, notes, and snippets.

@PaulKish
Last active July 1, 2016 06:55
Show Gist options
  • Save PaulKish/3f42805ae175237d79215cdae23991a2 to your computer and use it in GitHub Desktop.
Save PaulKish/3f42805ae175237d79215cdae23991a2 to your computer and use it in GitHub Desktop.
// execute process in the background
function execInBackground($cmd,$background=false) {
if($background == false){
exec($cmd);
}else{
if (substr(php_uname(), 0, 7) == "Windows"){
pclose(popen("start /B ". $cmd, "r"));
}else {
exec($cmd . " > /dev/null &");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment