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

当涉及到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
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#python#的问题:求帮写python代码
  • ¥15 LiBeAs的带隙等于0.997eV,计算阴离子的N和P
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 来真人,不要ai!matlab有关常微分方程的问题求解决,
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算
  • ¥15 java如何提取出pdf里的文字?