Php 第二个imagemagick命令的exec()权限被拒绝

Php 第二个imagemagick命令的exec()权限被拒绝,php,imagemagick,exec,Php,Imagemagick,Exec,我无法理解这一点,我运行了以下命令,第一个命令工作正常,然后运行第二个命令,权限被拒绝。我试过使用chmod(),但没有用,我被难倒了 // This line works: exec("$this->convert '$this->background' -resize 250 '$this->name'", $opt); // This line gives permission denied: exec("$this->mogrify xc:black -font

我无法理解这一点,我运行了以下命令,第一个命令工作正常,然后运行第二个命令,权限被拒绝。我试过使用
chmod()
,但没有用,我被难倒了

// This line works:
exec("$this->convert '$this->background' -resize 250 '$this->name'", $opt);

// This line gives permission denied:
exec("$this->mogrify xc:black -font '$font' -pointsize $font_size -draw \"text 240,10 '5'\" '$this->name'", $opt);
以下是更好的外观:

protected $convert    = "/usr/local/bin/convert";
protected $mogrify    = "/usr/local/bin/mogrify";

public function display($format = Turing::JPG, $quality = 100){
    // Create an image with a random background
    exec("$this->convert '$this->background' -resize 250 '$this->name'", $opt);
    $this->_buildText();
}

protected function _buildText(){
    $text = $this->turing;
    for($i = 0; $i < strlen($text); $i++){
        $font      = $this->getFont();
        $angle     = $this->getAngle();
        $font_size = $this->getFont(35, 45);
        if(stripos($font, "Kidnap_Note") !== false){
            $font_size = $this->getFont(45, 50);
        }
        $x = (40 - ($this->step / 2) + $i * 45);
        $y = 50;
        $opt = null;
        exec($q="$this->convert '$this->name' xc:black -font '$font' -pointsize $font_size -draw \"text 240,10 '{$text[$i]}'\" '$this->name'", $opt);
    }
}
protected$convert=“/usr/local/bin/convert”;
受保护的$mogrify=“/usr/local/bin/mogrify”;
公共函数显示($format=Turing::JPG,$quality=100){
//创建具有随机背景的图像
exec(“$this->convert'$this->background'-resize 250'$this->name'”,$opt);
$this->_buildText();
}
受保护函数_buildText(){
$text=$this->turing;
对于($i=0;$igetFont();
$angle=$this->getAngle();
$font\u size=$this->getFont(35,45);
if(stripos($font,“绑架通知”)!==false){
$font\u size=$this->getFont(45,50);
}
$x=(40-($this->step/2)+$i*45);
$y=50;
$opt=null;
exec($q=“$this->convert'$this->name'xc:black-font'$font'-pointsize$font\u size-draw\'text 240,10'{$text[$i]}'\'“$this->name'”,$opt);
}
}

我想您可以从命令行运行/usr/local/bin/mogrify吗?您已经运行了“ls-l/usr/local/bin”并比较了权限和uid/gid?是的,我从命令行运行了该命令看起来它确实有权限,我想我的命令是错误的。。。如果我更改命令,使图像的大小变小,它会工作。。。