I want to run a php file in background which has some mysql commands, I am unable to do so. Is it that php file based on cakephp framework doesnot run in background? To run a php file n background do i need to write it basic php format I am a beginner. I have tried commands like:
php filename.php
php filename.php &
php -a
exec( '/usr/bin/php -f /my/path/to/filename.php > /dev/null &' );
followed this tutorial "http://www.xphp.info/background-processing-with-php/"
please tell me.
the code is:
<?php
include_once "a_file.php";
class Calci{
var $ft = 350;
var $fl = 130;
var $lt = 60;
var $fbCount = 0;
var $liCount = 0;
var $twCount = 0;
var $nodeId = 0;
function index() {
App::import('model', 'User');
$user_model = new User();
$entry = $user_model->find("all", array("conditions" => array("not" => array("User.id" => null))));
foreach($entry as $e) {
$user_id = $e["User"]["id"];
$tr=$this->getTrUser($user_id);
$this->$e["User"]["id"]=$user_id;
$this->$e["User"]["true_reach"]=$tr;
$this->$e["User"]->save();
}
}
function getTrUser($id) {
// some calculation
}
}
?>