Imagemagick Problems

windows

Guest
I can't get ImageMagick to work on server49 anymore. It was working just a few days ago, and now it doesn't. I have several accounts with you all and the same scripts work on server23 so i'm almost sure its not my code. I've already submitted a helpdesk ticket and they replied saying nothing is wrong with image magick <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/eek.gif" style="vertical-align:middle" emoid=":eek:" border="0" alt="eek.gif" /> and recommended I post my problem here.<br /><br />Ok, so check this out. <br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--><?<br />echo shell_exec('whereis convert'); // Where is the path to convert/imagemagick<br />echo '<br />';<br />echo shell_exec('convert -version'); // What is the version of imagemagick running<br />exec('convert image.jpg -resize 50% new.jpg'); // Create a new image half the size of the original<br />?><!--c2--></div><!--ec2--><br /><br />Both of these are in a directory thats chmodded to 777.<br /><br />On <a href="http://upit.section31.us/test/" target="_blank">server 23</a>, everything works fine.<br />It outputs both the pathname and version and it creates the new image. <br /><!--quoteo--><div class='quotetop'>QUOTE</div><div class='quotemain'><!--quotec-->convert: /usr/X11R6/bin/convert /usr/bin/X11/convert /usr/local/bin/convert<br />Version: ImageMagick 5.5.6 04/01/03 Q16 <a href="http://www.imagemagick.org" target="_blank">http://www.imagemagick.org</a> Copyright: Copyright ?2003 ImageMagick Studio LLC<!--QuoteEnd--></div><!--QuoteEEnd--><br /><br />On <a href="http://upit.proteuszx.com/test/" target="_blank">server 49</a>. <br /><b>It outputs the pathname, doesn't output the version and doesn't create the new image. </b><br /><!--quoteo--><div class='quotetop'>QUOTE</div><div class='quotemain'><!--quotec-->convert: /usr/local/bin/convert<!--QuoteEnd--></div><!--QuoteEEnd--><!--content-->
I agree that it looks odd. One thing I'd suggest - modify your shell_exec() command so errors are redirected to standard output (where your script can capture them):<br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->echo shell_exec('convert -version 2>&1'); // What is the version of imagemagick running<!--c2--></div><!--ec2--><br />As your script is, you won't see any error messages from commands run by shell_exec() if one occurs. With the above change, error messages will be output to the page.<!--content-->
I took a look at phpinfo() on server 49, and this is what it's showing for the PATH environment variable:<br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin<!--c2--></div><!--ec2--><br />What's notable here is that the /usr/local/bin and /usr/local/sbin directories are not in your PATH environment. Since 'convert' is only available in the /usr/local/bin directory, you'd have to specify a full path to execute it:<br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->echo shell_exec('/usr/local/bin/convert -version');<!--c2--></div><!--ec2--><br />I'd be willing to bet that if you run your script after modifying it like I suggested above, you'll see an error like the following:<br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->sh: line 1: convert: No such file or directory<!--c2--></div><!--ec2--><br />...because 'convert' isn't in any of the directories listed in the PATH environment variable.<br /><br />I'd suggest reopening your Help Desk ticket (or submit a new one) and request that /usr/local/bin and /usr/local/sbin directories be added to the PATH environment variable.<!--content-->
You nailed it david... Thanks and I will notify the techs.<!--content-->
 
Back
Top