Re: exec / shell_exec issues

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2005-07-29 at 20:49, leonski wrote:
> 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." 

Ummm, looks to me like your escaping the entire command instead of just
individual arguments. Check if that's your problem.

Cheers,
Rob.

> -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.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux