Yii shell_exec yiic command run not working

916 views Asked by At

I am trying to send large number of email notifications using Yiic and run CConsoleCommand.

Command is okay. There are no PHP errors. I can't run linux command using shell_exec.

Here is part of code

if ($post->save()) {

  chdir(Yii::app()->basePath);
  shell_exec('yiic makemasspost ' . $post->id . ' ' . $id . ' > log.txt & echo $!');

}
1

There are 1 answers

0
Mihai P. On

There is no point in going to linux from yii to run a command that actually runs an yii application again.

You can try running it directly from Yii

Yii::import('application.commands.*');
$command = new MyCommand("test", "test");
$command->run(null);