Re: Re: system command runs application, but application doesn't work correctly

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

 



When you run it from the shell, you are you.

When you run it from a PHP web-server, you are not you.  You are
whatever user is configured in httpd.conf

That user will not have the same rights/permissions as you do.

They also won't have your same environment, e.g., home directory $HOME.

Check permissions on all files/directories.

Use complete pathnames from the root hard drive:
/home/apple/path/to/$outputFile

On Thu, January 17, 2008 5:48 pm, Apple7777 wrote:
> Richard Lynch <ceo <at> l-i-e.com> writes:
>
>>
>> Try writing a 2-line .sh (shell) script that does what you want, and
>> call that 2-liner from exec().
>
>
> Thanks for idea, Richard. But it doesn't work.
>
> I wrote code as you said:
>
> --------------------
> $first = "/usr/local/bin/mencoder -vf scale=448:-3,expand=448:336 -sws
> 9 -of
> lavf -ovc lavc -lavcopts
> vcodec=flv:vbitrate=250:trell:v4mv:mv0:mbd=2:cbp:aic:cmp=3:subcmp=3:vpass=1
> -frames 800 -ofps 24000/1001 -oac mp3lame -lameopts abr:br=64:mode=0
> -channels 1
> -srate 22050 -of lavf -lavfopts format=flv -o ".$outputFile."
> /home/re/ff/logo7.avi ".$inputFile."\n";
> $second = "/usr/local/bin/mencoder -vf scale=448:-3,expand=448:336
> -sws 9 -of
> lavf -ovc lavc -lavcopts
> vcodec=flv:vbitrate=250:trell:v4mv:mv0:mbd=2:cbp:aic:cmp=3:subcmp=3:vpass=2
> -frames 800 -ofps 24000/1001 -oac mp3lame -lameopts abr:br=64:mode=0
> -channels 1
> -srate 22050 -of lavf -lavfopts format=flv -o ".$outputFile."
> /home/re/ff/logo7.avi ".$inputFile;
>
> $fp = fopen("/home/re/video/enc", "w");
> fwrite($fp, $first);
> fwrite($fp, $second);
> fclose($fp);
>
> exec("/bin/bash /home/re/video/enc");
> --------------------
>
>
> I've also tried system() instead of exec(), and it displayed same
> output text as
> I posted above.
>
> The strangest thing is when I run this script from shell, everything
> works fine!
> Video encodes well. But when I call that script from PHP, nothing
> works.
>
> Another strange thing is I run ImageMajick with system() in a lot of
> scripts on
> the same server and everything works fine.
>
> What is the problem? Do you have any idea?
>
>
>
>
>
>
>
>
>
>
>
>>
>> On Thu, January 17, 2008 6:46 am, Apple7777 wrote:
>> > Daniel Brown <parasane <at> gmail.com> writes:
>> >
>> >>     Try replacing system() with die() and letting it print out
>> the
>> >> information full command string.  That may give you an idea of a
>> >> variable that's either incorrect or undefined.  If you copy and
>> >> paste
>> >> it and run the command from the command line and it works, then
>> it
>> >> may
>> >> be permissions issues.
>> >
>> > Daniel,
>> >
>> > This doesn't display anything:
>> > die($first);
>> > die($second);
>> >
>> > Full commands are:
>> > first: /usr/local/bin/mencoder -vf scale=448:-3,expand=448:336
>> -sws 9
>> > -of lavf
>> > -ovc lavc -lavcopts
>> > vcodec=flv:vbitrate=250:trell:v4mv:mv0:mbd=2:cbp:aic:cmp=3:subcmp=3:vpass=1
>> > -frames 800 -ofps 24000/1001 -oac mp3lame -lameopts
>> abr:br=64:mode=0
>> > -channels 1
>> > -srate 22050 -of lavf -lavfopts format=flv -o
>> /home/re/video/2/16.flv
>> > /home/re/ff/logo7.avi /home/re/video/2/16temp
>> >
>> > second:
>> > /usr/local/bin/mencoder -vf scale=448:-3,expand=448:336 -sws 9 -of
>> > lavf -ovc
>> > lavc -lavcopts
>> > vcodec=flv:vbitrate=250:trell:v4mv:mv0:mbd=2:cbp:aic:cmp=3:subcmp=3:vpass=1
>> > -frames 800 -ofps 24000/1001 -oac mp3lame -lameopts
>> abr:br=64:mode=0
>> > -channels 1
>> > -srate 22050 -of lavf -lavfopts format=flv -o
>> /home/re/video/2/16.flv
>> > /home/re/ff/logo7.avi /home/re/video/2/16temp
>> >
>> >
>> > I've set permissions of all test files and directories to 777. But
>> > still my
>> > script doesn't work.
>> >
>> >
>> >
>> >
>> >>
>> >>     One part of the snipped content that I noticed kept repeating
>> is
>> >> the following (and actually ending with this line):
>> >>         'VDecoder init failed :( Read DOCS/HTML/en/codecs.html'
>> >>
>> >>     Did you follow the advice and read that document?
>> >
>> > Yes. It's just describes codecs. But I know mencoder support those
>> > codecs,
>> > because it encodes videos when it's called from SSH.
>> >
>> >
>> >>     Beyond that, it's a question that should probably instead be
>> >> asked
>> >> on a mencoder mailing list, since PHP's system() function is
>> working
>> >> correctly, but apparently isn't getting the information it needs
>> to
>> >> pass stuff back-and-forth with the system.
>> >>
>> >
>> >
>> >
>> >
>> > I've already asked this question in Mencoder group, by noone
>> replied.
>> >
>> > I thinkit's because mencoder works fine and it doesn't work only
>> when
>> > I call it
>> > from PHP.
>> >
>> > The thing is when I copy/paste commands above to SSH, everything
>> works
>> > fine.
>> >
>> > Do you have any thoughts?
>> >
>> > --
>> > PHP General Mailing List (http://www.php.net/)
>> > To unsubscribe, visit: http://www.php.net/unsub.php
>> >
>> >
>>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

-- 
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