user3343663
user3343663

Reputation: 23

Yii shell_exec yiic command run not working

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 $!');

}

Upvotes: 0

Views: 945

Answers (1)

Mihai P.
Mihai P.

Reputation: 9357

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);

Upvotes: 0

Related Questions