PHP

HOW TO RUN PHP SCRIPTS IN THE BACKGROUND

THIS BACKGROUND SCRIPT WILL CREATE A "DUMMY.TXT" FILE. file_put_contents(   "dummy.txt",   "Ran at ". date("Y-m-d H:i:s") );

BACKGROUND SCRIPT

01

SCRIPT TO RUN $script ="background.php";

RUN BACKGROUND SCRIPT

02

RUN SCRIPT IN COMMAND LINE switch (strtolower(PHP_OS_FAMILY)) {   case "windows":     pclose(popen("start /B php $script", "r"));     break;     case "linux":     exec("php $script > /dev/null &");     break; }