Re: exec / shell_exec issues
| From: | leonski | Date: | Sat, 30 Jul 2005 03:31:28 +0000 |
| Subject: | Re: exec / shell_exec issues | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-219663@lists.php.net to get a copy of this message | ||
Robert Cummings wrote:
On Fri, 2005-07-29 at 22:45, leonski wrote:I've just tried this using convert instead of mogrify so I can interject and grab the image as its being written to /tmp. - I checked out what Jason was saying too and he is also very right - the errors were obviously not mogrify errors (der! on my part). Turns out now it WORKS (since I'm escaping correctly now)!!!! My eyball sockets thank you both. In a great Aussie tradition I'd buy you a beer or three if you were here! Could also substitute coffee, pepsi max etc depending on preferred poison. Thanks soooooo much. I only hope to be able to spot these issues as rapidly as you guys and give back to the community too. Cheers, leonski.Robert Cummings wrote:Aaaaah, but the above error is a completely different error than you were posting previously, so we've moved past the first error which was as I suspected. Cheers, Rob. Indeed you are very right - it seems mogrify is working, but I'm stuffing up something else.....On Fri, 2005-07-29 at 22:17, leonski wrote:did: if( file_exists( $imagefile ) )Jason Wong wrote:Because you've used escapeshellargs() (or whatever it is) it's probably treating the entire parameter to exec() (excluding the string concatenation for output redirection) as the command to execute. I know you said you tried it otherwise but try the following: if( file_exists( $imagefile ) ) { $arg = escapeshellarg( $imagefile ); exec( "/usr/local/bin/mogrify $arg -resize 95x72 "); } Cheers, Rob.On Saturday 30 July 2005 08:49, leonski wrote::-( yeah it does and it works under the terminal (nicely I might add, thanks ImageMagick). leonski.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 think the error message is trying to tell you that "/usr/local/bin/mogrify" does not exist.{ $arg = escapeshellarg( $imagefile ); echo $str= "/usr/local/bin/mogrify $arg -resize 95x72 "; exec($str); }added a line so I could see the string.... got: /usr/local/bin/mogrify '/tmp/phpPdCiGS' -resize 95x72 Warning: fopen('/tmp/phpPdCiGS') [function.fopen]: failed to open stream: No such file or directory in /Library/WebServer/Documents/build2/admin/classes/class_upload.php on line 254 so again - how does it get past the file_exists if it doesn't?!!! keep it coming Robert....;-)