Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't execute a linux command using exec( ) function

Status
Not open for further replies.

akgta

Programmer
Jul 18, 2007
42
CA
I can't execute a linux command using the exec() function in a php script, please view the following test code:

<?
exec("ffmpeg -i sample.avi -qscale 15 sample.flv");
?>

on the command prompt the command executes perfectly like this:
ffmpeg -i sample.avi -qscale 15 sample.flv
which works.

The directory has the chmod 777 permission

How can I get it to work, please help thanks in advance.
 
Have you tried system() in lieu of exec()? Have you tried using absolute path?

I have had problems where these commands will not execute. Not been more than a journey man admin, I have to pass the problem to others with greater experience w/ OS related stuff.

I never get an answer to "So, what was the problem?" :-(





--
SouthBeach
The good thing about not knowing is the opportunity to learn - Yours truly, 2008.
 
i already tried system( ), also executed:
# chmod 777 /usr/bin/ffmpeg
giving full permission rights to ffmpeg for execution.

No luck yet.
 
I never get an answer to "So, what was the problem?

I think this is meant seriously. "It doesn't work" is not very descriptive. Can't you at least tell us what the problem is?

See also this thread for how to read the output of a shell command.


+++ Despite being wrong in every important aspect, that is a very good analogy +++
Hex (in Darwin's Watch)
 
pls note that a chmod from a sapi php environment is unlikely to work unless for some reason the user is the owner of the file in question.

try sudo'ing to the web user and running the command from the directory in question and see what the bash error output is.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top