douang2297 2015-06-19 22:56
浏览 61

Yii shell_exec yiic命令运行不起作用

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条回答 默认 最新

  • dongshadu2546 2015-06-22 01:52
    关注

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

报告相同问题?

悬赏问题

  • ¥15 神经网络怎么把隐含层变量融合到损失函数中?
  • ¥30 自适应 LMS 算法实现 FIR 最佳维纳滤波器matlab方案
  • ¥15 lingo18勾选global solver求解使用的算法
  • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行
  • ¥15 Python3.5 相关代码写作
  • ¥20 测距传感器数据手册i2c
  • ¥15 RPA正常跑,cmd输入cookies跑不出来
  • ¥15 求帮我调试一下freefem代码
  • ¥15 matlab代码解决,怎么运行
  • ¥15 R语言Rstudio突然无法启动