2016-07-15 9 views
0

私のコードに問題があります。PHPのexecコマンド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 > 

また、Apacheはそれを実行する権限を持っていないようですね

答えて

1

動作しないいくつかのことをチェックするために

1)(場合CentOS/RHEL)selinuxは停止していますか?一時的に無効にするには

setenforce 0 

はPerminetlyそれは

chmod +x /usr/bin/pdfimages 

、apacheのことではないexecutible

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

2)(アクセスを必要とするすべてのファイルとは/ usr/binに/ pdfimagesを交換)してみ許可する場合thoughsの仕事の地獄、何あなたのサーバーは稼動していますか?

+0

編集できませんか? – bradley546994

+0

var_dump(exec( "/ usr/bin/pdfimages -png /path/pdf/file.pdf/tmp/savefile /"))とは何ですか?出力 –

+0

this:string(0) "" – bradley546994

関連する問題