Windows Application Faulting Event from php calling new Imagick($pdfFn);

IMagick is a native PHP extension to create and modify images using the ImageMagick API. ImageMagick Studio LLC did not write nor does it maintain the IMagick extension, however, IMagick users are welcome to discuss the extension here.
Post Reply
Abe2020
Posts: 2
Joined: 2020-02-14T12:58:50-07:00
Authentication code: 1152

Windows Application Faulting Event from php calling new Imagick($pdfFn);

Post by Abe2020 »

Hi, I have a windows environment running php7.0.33 against an install of ImageMagick from https://mlocati.github.io/articles/php- ... agick.html (php_imagick-3.4.3-7.0-ts-vc14-x64.zip and ImageMagick-6.9.3-7-vc14-x64.zip), and when I run a simple test for Imagick it works "Ok".

But when I try to run it with a small PDF file (577K), using the php command below..

Code: Select all

$pdfFn="C:/wamp64/tmp/php57DE.pdf";
$im = new Imagick($pdfFn);
.... it blows up with a Windows Application Error seen in the Windows Events log viewer app - reading:

Code: Select all

Faulting application name: httpd.exe, version: 2.4.41.0, time stamp: 0x5d4d8786
Faulting module name: gsdll64.dll, version: 0.0.9.50, time stamp: 0x5da590fb
Exception code: 0xc0000005
Faulting process id: 0x2a10
Faulting application start time: 0x01d5e36adaf5c259
Faulting application path: C:\wamp64\bin\apache\apache2.4.41\bin\httpd.exe
Faulting module path: C:\Program Files\gs\gs9.50\bin\gsdll64.dll
Report Id: 3699c988-8148-49df-b83d-75c8facb73c6
Faulting package full name: 
Faulting package-relative application ID: 
(and the PHP stops completely - the code is actually in a try catch, but the catch doesn't run)


Does anyone know why this should fail? (Note, on a Linux install - the same PDF works ok)

Thanks
Abe

User avatar
fmw42
Posts: 26261
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Windows Application Faulting Event from php calling new Imagick($pdfFn);

Post by fmw42 »

Imagemagick 6.9.3.7 is ancient. That could be part of the issue.

But, mainly, you need to have Ghostscript installed where Imagemagick and PHP can find it. Often you need to edit the delegates.xml file to put the full path to gs in the command=""gs" for PHP to find it.

You may also have to edit the policy.xml file to give permissions for reading PDF.

User avatar
dlemstra
Posts: 1610
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Windows Application Faulting Event from php calling new Imagick($pdfFn);

Post by dlemstra »

Your ImageMagick version does not work with such a recent version of GhostScript because the behavior of that library was changed (more details here: https://github.com/ImageMagick/ImageMagick/pull/1538). You will either need to upgrade ImageMagick or downgrade GhostScript.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate

Abe2020
Posts: 2
Joined: 2020-02-14T12:58:50-07:00
Authentication code: 1152

Re: Windows Application Faulting Event from php calling new Imagick($pdfFn);

Post by Abe2020 »

Thanks - I was using the only half-useful installation documentation I could find (https://mlocati.github.io/articles/php- ... agick.html), but if that is not up to date then I'm not sure where I should go for a newer version of ImageMagick [that works with php7.0) - can you suggest where to find more up to date install documentation?

(I'm not sure what the "delegates.xml" file is - I've searched my C drive and cannot find any existence of it)

Thanks
Abe

Post Reply