Page 1 of 1

Works from command line, not via PHP??

Posted: 2007-05-30T14:35:30-07:00
by whoisgregg
Hi!

This code run from the command line and from within PHP using exec produces quite different output:
/usr/local/ImageMagick-6.3.4/bin/identify -debug All '/Library/WebServer/Documents/play/multipage/input/test.pdf'
From the command line it works and from PHP it does not work. Specifically, from the command line the debug includes:
2007-05-30T17:05:42-04:00 0:01 0.030u 6.3.4 Resource identify[5101]: resource.c/unknown/406/Resource
/var/tmp/magick-QLqzKqpI
2007-05-30T17:05:43-04:00 0:02 0.030u 6.3.4 Blob identify[5101]: blob.c/unknown/2270/Blob
read 4096 magic header bytes
2007-05-30T17:05:43-04:00 0:02 0.030u 6.3.4 Cache identify[5101]: cache.c/unknown/1952/Cache
destroy
2007-05-30T17:05:43-04:00 0:02 0.030u 6.3.4 Module identify[5101]: module.c/unknown/1065/Module
Searching for module "PNM" using filename "pnm.la"
2007-05-30T17:05:43-04:00 0:02 0.030u 6.3.4 Module identify[5101]: module.c/unknown/582/Module
Searching for coder module file "pnm.la" ...
2007-05-30T17:05:43-04:00 0:02 0.030u 6.3.4 Module identify[5101]: module.c/unknown/1085/Module
Opening module at path "/usr/local/ImageMagick-6.3.4/lib/ImageMagick-6.3.4/modules-Q16/coders/pnm.la"
Oddly, from PHP the debug includes this code in the same place:
2007-05-30T17:05:33-04:00 0:01 0.030u 6.3.4 Resource identify[5084]: resource.c/unknown/406/Resource
/var/tmp/magick-gds0ujh9
2007-05-30T17:05:33-04:00 0:01 0.030u 6.3.4 Blob identify[5084]: blob.c/unknown/2270/Blob
read 0 magic header bytes
2007-05-30T17:05:33-04:00 0:01 0.030u 6.3.4 Cache identify[5084]: cache.c/unknown/1952/Cache
destroy
2007-05-30T17:05:33-04:00 0:01 0.030u 6.3.4 Module identify[5084]: module.c/unknown/1065/Module
Searching for module "AVI" using filename "avi.la"
2007-05-30T17:05:33-04:00 0:01 0.030u 6.3.4 Module identify[5084]: module.c/unknown/582/Module
Searching for coder module file "avi.la" ...
2007-05-30T17:05:33-04:00 0:01 0.030u 6.3.4 Module identify[5084]: module.c/unknown/1085/Module
Opening module at path "/usr/local/ImageMagick-6.3.4/lib/ImageMagick-6.3.4/modules-Q16/coders/avi.la"
To avoid a huge code dump I've tried to only post relevant code sections. It looks to me like the difference between "PNM" and "AVI" is the greatest difference in the debug code dumps. But, I'm not really sure if that's the issue at all. :/


Output of --version is identical from both methods of calling imagemagick:
Version: ImageMagick 6.3.4 05/05/07 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2007 ImageMagick Studio LLC
I'll happily provide additional information. Thanks in advance for your help! :)

Re: Works from command line, not via PHP??

Posted: 2007-05-30T14:54:41-07:00
by whoisgregg
It turns out it was a problem with ghostscript. It didn't know the search path to find the gs executable.

I edited the delegates.xml file to include a full path to gs:
command='"gs"
became:
command='"/sw/bin/gs"
And all is now well with the universe... until the next issue. ;)