Just use this feature. It runs on both operating systems (Windows and Linux):
function execInBackground($cmd){ if (substr(php_uname(), 0, 7) == "Windows"){ pclose(popen("start /B ". $cmd, "r")); }else{ exec($cmd . " > /dev/null &"); } }
Here is a simple example of using a function:
execInBackground('php feed/handleFeed.php db_name '.$second_param);
In the above example, we start the script handleFeed.php , which is located in a folder called "feed" , and we pass parameters 2 (the database name and another second parameter).
source share