dsfasdfsda234234 2015-05-18 17:18
浏览 387
已采纳

当涉及到pdf时,php imagick错误

When I try to convert the first page of a PDF into JPG through PHP imagick, I get an HTTP 500 error with no log in php_errors.log.

Explanation from IIS: The FastCGI process exited unexpectedly

Error code: 0xc0000417

Two files are created in C:\Windows\Temp, the first one is the PDF read; the other is 0 Kb length.

I am able to perform command line conversions with ImageMagick (convert some.pdf some.jpg). So, ImageMagick and GhostScript are running fine. Also, I am able tho convert between JPG and GIF from PHP scripts.

PHP code:

$im = new Imagick();
$im->setResolution(300,300);
$im->readimage('poster.pdf[0]'); 
$im->setImageFormat('jpeg');    
$im->writeImage('poster.jpg'); 
$im->clear(); 
$im->destroy();

My environment:

  • Windows 7 Professional 64 bit
  • IIS 7.5
  • PHP 5.3.6 NTS VC9 via FastCGI
  • PHP imagick extension v.3.1.2 (5.3 NTS VC9 x86, from PECL)
  • ImageMagick-6.7.7-0-Q16-windows-dll (x86)
  • GhostScript 9.07 win32 (x86)
  • Microsoft Visual C++ 2008 redistributable x86
  • Path to ImageMagick added to PATH environment variable
  • Permissions granted to IUSR and IIS_IUSRS in folders C:\Windows\Temp and C:\imagemagick.

So, can anyone give me some guidance to debug this error and have the thing running?

  • 写回答

1条回答 默认 最新

  • dsvtnz6350 2015-05-19 15:40
    关注

    As Danack suggested, ImageMagick MUST be downloaded from the same place imagick was. Compiler version and processor architecture must be respected to match the ones of PHP and GhospScript (in my case, VC9, x86).

    Nevertheless, not all versions of ImageMagick availables at this repository appear to be consistent with those of imagick and / or GhostScript. In my case, the combination that finally worked (at second attempt) was:

    • imagick 3.1.2
    • ImageMagick 6.8.8
    • GhostScript 9.07
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?