section31 Posted May 27, 2005 Posted May 27, 2005 (edited) 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 and recommended I post my problem here. Ok, so check this out. ><? echo shell_exec('whereis convert'); // Where is the path to convert/imagemagick echo '<br />'; echo shell_exec('convert -version'); // What is the version of imagemagick running exec('convert image.jpg -resize 50% new.jpg'); // Create a new image half the size of the original ?> Both of these are in a directory thats chmodded to 777. On server 23, everything works fine. It outputs both the pathname and version and it creates the new image. convert: /usr/X11R6/bin/convert /usr/bin/X11/convert /usr/local/bin/convertVersion: ImageMagick 5.5.6 04/01/03 Q16 http://www.imagemagick.org Copyright: Copyright © 2003 ImageMagick Studio LLC On server 49. It outputs the pathname, doesn't output the version and doesn't create the new image. convert: /usr/local/bin/convert Edited May 27, 2005 by section31 Quote
TweezerMan Posted May 27, 2005 Posted May 27, 2005 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): >echo shell_exec('convert -version 2>&1'); // What is the version of imagemagick running 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. Quote
TweezerMan Posted May 27, 2005 Posted May 27, 2005 I took a look at phpinfo() on server 49, and this is what it's showing for the PATH environment variable: >/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin 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: >echo shell_exec('/usr/local/bin/convert -version'); 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: >sh: line 1: convert: No such file or directory ...because 'convert' isn't in any of the directories listed in the PATH environment variable. 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. Quote
section31 Posted May 28, 2005 Author Posted May 28, 2005 You nailed it david... Thanks and I will notify the techs. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.