2015-05-18 17:18
浏览 370

当涉及到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();

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?

图片转代码服务由CSDN问答提供 功能建议

当我尝试通过PHP imagick将PDF的第一页转换为JPG时,我收到HTTP 500错误 没有登录php_errors.log。

IIS的说明: FastCGI进程意外退出

错误代码: 0xc0000417

C:\ Windows \ Temp 中创建两个文件,第一个是PDF读取; 另一个是0 Kb长度。

我能够使用ImageMagick执行命令行转换(转换some.pdf some.jpg)。 所以,ImageMagick和GhostScript运行正常。 此外,我能够从PHP脚本转换JPG和GIF。


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


    \ n
  • Windows 7 Professional 64位
  • IIS 7.5
  • PHP 5.3.6 NTS VC9通过FastCGI
  • PHP imagick扩展v .3.1.2(5.3 NTS VC9 x86,来自PECL)
  • ImageMagick-6.7.7-0-Q16-windows-dll(x86)
  • GhostScript 9.07 win32 (x86)
  • Microsoft Visual C ++ 2008可再发行组件x86
  • 添加到PATH环境变量的ImageMagick路径
  • 授予IUSR和IIS_IUSRS的权限 在文件夹 C:\ Windows \ Temp C:\ imagemagick

    所以,任何人都可以给 我有一些指导来调试这个错误并让事情运行?

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

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
    解决 无用
    打赏 举报