I'm trying to "faux-fork" a process (an email being sent via SMTP) in my web application, and the application is built on Kohana.
$command = 'test/email';
exec('php index.php '.$command.' > /dev/null/ &', $errors, $response);
I'm getting an error --
Notice: Undefined index: SERVER_NAME
When I look into Kohana's index.php file, I see that it is looking for a variable named SERVER_NAME, but I guess it is coming up NULL because Kohana couldn't detect this value and set it prior to run.
Any ideas how to get Kohana to run via command line?
exec('php index.php --uri='.$command.' > /dev/null &', $errors, $response);
but from the rest of your question, I think it might be better to use a cronjob for it or if you use kohana3, use its HMVC-capabilities – Rotzphp index.php --task=demo
, where this demo is saved inclasses/Task/demo.php
as aclass Task_Demo extends Minion_Task
. For more info check here kohanaframework.org/3.3/guide/minion/tasks – Yelenayelich