IM working from command line not from PHP
Posted: 2008-11-04T16:44:48-07:00
I've read some very lengthy posts here about this, but still cannot call IM from a PHP file. Here's what I know:
----------------------------
From command line:
convert -version
Version: ImageMagick 6.2.0 07/10/05 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2005 ImageMagick Studio LLC
type convert
convert is hashed (/usr/bin/convert)
According to my admin guys, the following works fine:
/usr/local/bin/convert page1.jpg output.gif
---------------------------
From PHP, the screen is blank, the file isn't converted, and the error in the log is:
sh: line 1: /convert: No such file or directory
-----------------------------
If I run this:
$env_vars = explode( ':', $HTTP_ENV_VARS['PATH']);
$path = $env_vars[1]."/convert";
echo $path;
I get this:
/usr/sbin/convert
If I run this:
echo $HTTP_ENV_VARS['PATH'];
I get this:
/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin
--------------------------------
I have tried all of the following, and none work:
system("convert I-70Scout.jpg THscout.gif");
system("/usr/bin/convert I-70Scout.jpg THscout.gif");
system("/usr/bin/local/convert I-70Scout.jpg THscout.gif");
system("/usr/sbin/local/convert I-70Scout.jpg THscout.gif");
system("/usr/sbin/convert I-70Scout.jpg THscout.gif");
---------------------
If I run this using any of the above paths and no paths:
$array=array();
echo "<pre>";
exec("/usr/bin/convert I-70Scout.jpg 41.png 2>&1", $array);
echo "<br>".print_r($array)."<br>";
echo "</pre>";
I get:
Array
(
)
1
--------------------------
I've tried using the this with variations of the path, but it didn't work either:
system("PATH=\$PATH:/usr/sbin/ && convert 'page1.pdf[0]' 'abcde.jpg' 2>&1");
-------------------------
Does anybody have any other ideas?
I am running PHP 4.3 - could that be the problem?
Thanks in advance for any help you can give me -
----------------------------
From command line:
convert -version
Version: ImageMagick 6.2.0 07/10/05 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2005 ImageMagick Studio LLC
type convert
convert is hashed (/usr/bin/convert)
According to my admin guys, the following works fine:
/usr/local/bin/convert page1.jpg output.gif
---------------------------
From PHP, the screen is blank, the file isn't converted, and the error in the log is:
sh: line 1: /convert: No such file or directory
-----------------------------
If I run this:
$env_vars = explode( ':', $HTTP_ENV_VARS['PATH']);
$path = $env_vars[1]."/convert";
echo $path;
I get this:
/usr/sbin/convert
If I run this:
echo $HTTP_ENV_VARS['PATH'];
I get this:
/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin
--------------------------------
I have tried all of the following, and none work:
system("convert I-70Scout.jpg THscout.gif");
system("/usr/bin/convert I-70Scout.jpg THscout.gif");
system("/usr/bin/local/convert I-70Scout.jpg THscout.gif");
system("/usr/sbin/local/convert I-70Scout.jpg THscout.gif");
system("/usr/sbin/convert I-70Scout.jpg THscout.gif");
---------------------
If I run this using any of the above paths and no paths:
$array=array();
echo "<pre>";
exec("/usr/bin/convert I-70Scout.jpg 41.png 2>&1", $array);
echo "<br>".print_r($array)."<br>";
echo "</pre>";
I get:
Array
(
)
1
--------------------------
I've tried using the this with variations of the path, but it didn't work either:
system("PATH=\$PATH:/usr/sbin/ && convert 'page1.pdf[0]' 'abcde.jpg' 2>&1");
-------------------------
Does anybody have any other ideas?
I am running PHP 4.3 - could that be the problem?
Thanks in advance for any help you can give me -