Php执行命令pdftoimage不起作用

问题描述:

我的代码有问题。Php执行命令pdftoimage不起作用

我的代码是这样的:

$destinationFolder = $destinationRootFolder . '/'; 

//  mkdir($destinationFolder,777); 

     $options = $this->buildOptions($saveAsJpeg, $inputPdf, $destinationFolder); 
     print_r($options); 
//  exit; 
     try { 
      $command = "/usr/bin/pdfimages ".$options[0]." ".$options[1]." ".$options[2]; 
      echo $command; 
//   exit; 
      shell_exec($command); 
      exec($command); 

//   $command; 
//   echo $r; 

     } catch (ExecutionFailureException $e) { 
      throw new RuntimeException('PdfImages was unable to extract images', $e->getCode(), $e); 
     } 

代码中输入第一个命令在执行之前。当到控制台的复制命令一切正常,但不创建PHP文件PNG。


编辑

[email protected]:~# php -a 
Interactive mode enabled 

php > ls 
php > exec("/usr/bin/pdfimages -png /path/pdf/file.pdf /tmp/savefile/") 
php > shell_exec("/usr/bin/pdfimages -png /path/pdf/file.pdf /tmp/savefile/") 
php > 

它也不起作用

这听起来像阿帕奇没有权限来运行它,有几件事情要检查

1)(如果CentOS/RHEL)是selinux停止它,暂时禁用它

setenforce 0 

Perminetly允许它被Apache不executible

chcon -v --type=httpd_sys_content_t /usr/bin/pdfimages 

2)(与需要访问所有文件替换了/ usr/bin中/ pdfimages),尝试

chmod +x /usr/bin/pdfimages 

如果几点思考工作的幽冥,什么os是你的服务器运行?

+0

不起作用,你可以看看编辑? – bradley546994

+0

var_dump(exec(“/ usr/bin/pdfimages -png /path/pdf/file.pdf/tmp/savefile /”));输出 –

+0

这个:string(0)“” – bradley546994