1
我正在使用Symfony2 Process組件來觸發生成相當大報表的cli腳本。在這一點上,我使用ajax來監視它的進度,並在前端顯示進度條。在app_dev.php中執行以下代碼時,它運行完美並且沒有問題。但是,當我在生產中運行它時,它無法啓動Process()。Symfony2 Process :: start()在生產環境中運行時失敗
這裏是我的代碼:
public function generateAction($reportSlug)
{
$this->wrangler->addMoodleGlobal('CFG');
$time = time();
$commandSlug = "report:{$reportSlug}";
$console = $this->container->get('kernel')->getRootDir() ."/console";
$process = new Process("exec php {$console} {$commandSlug} {$time} > /dev/null 2>/dev/null &");
$process->start();
return $this->renderJson(json_encode(array(
'success' => true,
'message' => "php {$console} {$commandSlug}",
'time' => $time
)));
}
我已經運行php app/console cache:clear --env="prod"
以及php app/console cache:warmup --env="prod"
機器人無濟於事。
謝謝。
這是共享的託管服務嗎?有時共享主機服務不允許執行某些過程,我與hostinger有此問題.... – pbenard 2015-04-01 06:35:50