Page 1 of 1

Certain commands executed via PHP shell fail

Posted: 2015-08-17T00:54:08-07:00
by davidenco
This issue occurs with versions 6.9.1-6, 6.9.1-7, 6.9.1-8, 6.9.1-9 and 6.9.1-10. The problem does not occur with 6.9.1-4.

Code: Select all

CentOS 6.7 x64
PHP 5.5.28
GPL Ghostscript 9.16 (2015-03-30)
ImageMagick 6.9.1-6 Q16 x86_64 2015-06-25
I need to convert a PDF to an image as follows:

Code: Select all

<?php
echo shell_exec('/usr/local/bin/convert -density 300 /path/to/file.pdf -resize 25% -compress lossless -quality 0 /path/to/file.jpg');
?>
However the output from this command is:

Code: Select all

Unknown device: pamcmyk32
Unrecoverable error: undefined in .uninstallpagedevice Operand stack:
    defaultdevice
If I execute the exact same command via SSH, it works! But why?!

Re: Certain commands executed via PHP shell fail

Posted: 2015-08-17T01:06:52-07:00
by snibgo
Is it running the same version of Ghostscript?

Re: Certain commands executed via PHP shell fail

Posted: 2015-08-17T02:03:11-07:00
by davidenco
Yes, Ghostscript didn't change throughout the different ImageMagick versions.