Skip to content

Instantly share code, notes, and snippets.

@aziz-blr
aziz-blr / background-script.php
Created August 1, 2017 09:39
Execute php script in background
function execInBackground($cmd){
if (substr(php_uname(), 0, 7) == "Windows"){
pclose(popen("start /B ". $cmd, "r"));
}else{
exec($cmd . " > /dev/null &");
}
}
// Pass parameter if you need
//$second_param = 1;