2016-07-15 2 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 > 

또한, 아파치가 그것을 실행할 수있는 권한이없는 것 소리

답변

1

작동하지 않는 몇 가지 확인

1) (있는 경우 CentOS/RHEL) selinux가 멈추었습니까? 일시적으로 비활성화하려면

setenforce 0 

이 Perminetly이

chmod +x /usr/bin/pdfimages 

, 아파치하지 executible

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

2) (액세스를 필요로하는 모든 파일은/usr/빈/pdfimages 교환) 시도 허용하는 경우 thoughs 작업의 지옥, 무엇 OS가 실행중인 서버입니까?

+0

편집 할 수 있습니까? – bradley546994

+0

var_dump (exec ("/ usr/bin/pdfimages -png /path/pdf/file.pdf/tmp/savefile /")); 출력 –

+0

this : string (0) "" – bradley546994

관련 문제