You are here: exec nor shell_exec not doing as expected. « PHP « IT news, forums, messages
exec nor shell_exec not doing as expected.

Posted by leonski on 07/29/05 15:24

Greetings.

I've practically worn my eyeballs out trying to figure out a problem and
in desperation am posting here in the hope for familiar eyes to guide
me, so thanks in advance.

check out this code section:

if (file_exists($imagefile)) {
$execstring = escapeshellarg("/usr/local/bin/mogrify ".$imagefile."
-resize 95x72! ");
}
else echo ("sorry there was a problem with that file");
// then....2>&1 is assisting the debug
$op = shell_exec($execstring.' 2>&1');
echo $op;

pretty simple - uses the ImageMagick: mogrify. Funny enough it doesn't
work. The output is:

sh: line 1: /usr/local/bin/mogrify /tmp/phpS1KCen -resize 320x240! :
No such file or directory sh: line 1: /usr/local/bin/mogrify
/tmp/phpS1KCen -resize 95x72! : No such file or directory

beats me how it gets inside the if, if it doesn't exist!

I have also tried ImageMagick:convert executable with a generated
tempfile using tempnam() and the file is created in /tmp as expected,
but is not filled by the convert - it stays empty, fails and doesn't get
cleaned up.

I cannot give a link to php.ini as its not on a public server. But Safe
mode is Off, file size limits are OK as $imagefile can be displayed to
the screen prior to the shell_exec call.

I also tried using GD instead of ImageMagick and could not get
imagecreatetruecolor to work either.

OS is OS X on my laptop, entropy build of PHP as "Apache/1.3.29 (Darwin)
PHP/5.0.4"

I really do not know if this is a PHP, Apache or OS issue. Permissions
are not it, I'm sure, and the user is www quite capable of writing into
and reading from tmp, so there is no issue there.

If anybody can tell me what *anything* about this problem, I'd be greatful.

leonski.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация