I would suggest checking either popen or curl multi .
The easiest way:
$fh = popen("php /path/to/my/script.php");
// Do other stuff
// Wait for script to finish
while (fgets($fh) !== false) {}
// Close the file handle
pclose($fh);
If you do not want to wait until it ends at all:
exec("php /path/to/my/script.php >> /dev/null &");
or
exec("wget http//www.example.com/myscript.php");
source
share