Created
August 1, 2017 09:39
-
-
Save aziz-blr/13067e67af90aa6aabfd24da52c8f19c to your computer and use it in GitHub Desktop.
Execute php script in background
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
//execInBackground('php E:/aziz/xampp/htdocs/dompdf-example/index.php db_name '.$second_param); | |
execInBackground('php E:/aziz/xampp/htdocs/dompdf-example/index.php '); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment