note 55438 deleted from function.exec by danbrown

From: Date: Sun, 04 Jan 2009 16:28:53 +0000
Subject: note 55438 deleted from function.exec by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-148808@lists.php.net to get a copy of this message
Note Submitter: juha at kuhazor dot idlegames dot com ---- This technique was post posted by someone else earlier, however it did not work for me. This works with all Linux distros as long as path to your PHP processor is correct. The exec will return the PID for the process. <? $pid=exec("/usr/local/bin/php run.php > /dev/null & echo \$!"); echo $pid; ?> My run.php script is here, it is good for testing. <? function getmicrotime() { list($usec, $sec) = explode(" ", microtime()); return ((float)$usec + (float)$sec); } $starttime = getmicrotime(); $date=date("d/m/Y H:i",time()); echo "Started sleeping\n"; sleep(30); $endtime = getmicrotime(); echo "Woke up\n"; echo "Slept ".round(($endtime-$starttime),2)."\n"; ?>

« previous php.notes (#148808) next »