Calling apps from php



Hi everyone,

REALLY stuck and not sure what else I can do…

I have installed mencoder (and ffmpeg, flvtool2 and lame) in /usr/USER/bin and lame libs are availabel in /usr/USER/lib.

I am calling mencoder via exec in php like so…

exec(‘home/USER/bin/mencoder /home/USER/ -o /home/questijn/ -of lavf -oac mp3lame -lameopts abr:br=56 -ovc lavc -lavcopts vcodec=flv:vbitrate=800:mbd=2:mv0:trell:v4mv:cbp:last_pred=3 -vf scale=390:290 -srate 22050’,$op,$r);

which returns $op => Array(); - empty array - and $r =>127

Using teh exact same command in the shell the app runs successfully and creates the flv. IN order to make all teh shared libs availabel I have added:

export TMPDIR=$HOME/tmp
export PATH=$HOME/bin:$PATH
export LD_LIBRARY_PATH=$HOME/lib:/usr/local/lib:$LD_LIBRARY_PATH
export CPATH=$HOME/include:/usr/local/include:$CPATH
export LIBRARY_PATH=$HOME/lib:/usr/local/lib:$LIBRARY_PATH

to the .bash_profile file in /usr/USER. I also have the same settings in further .bash_profile files in /usr/USER/etc AND /usr/USER/etc/profile.

one point - don’t know how relevant it is but if I run

xec(‘echo $PATH’,$op);

the output is:

Array ( [0] => /usr/local/bin:/usr/bin:/bin )

can anyone suggest a reason why I can’t run these apps from php? am I missing some permission problem or similar?

Any help would be greatfully recieved and will pay the person who gives me the solution!!! I am that hacked off with it now!


Hi toonmariner,

Check out this thread. It seems to have same thing with your problem.

Hope this helps !




thanks for the reply tried:

export TMPDIR=/usr/USER/tmp; export PATH=/usr/USER/bin:$PATH; export LD_LIBRARY_PATH=/usr/USER/lib:/usr/local/lib:$LD_LIBRARY_PATH; export CPATH=/usr/USER/include:/usr/local/include:$CPATH; export LIBRARY_PATH=/usr/USER/lib:/usr/local/lib:$LIBRARY_PATH; /home/USER/bin/mencoder /home/USER/SITE.COM/mediatmp/64.mpg -o /home/USER/SITE.COM/flvideo/13.flv -of lavf -oac mp3lame -lameopts abr:br=56 -ovc lavc -lavcopts vcodec=flv:vbitrate=800:mbd=2:mv0:trell:v4mv:cbp:last_pred=3 -vf scale=390:290 -srate 22050

not a dickie bird

If anyone can sort this for me I will be happy to pay them…


“/usr/USER/…” will not be found. Did you want /home/USER/… ?


no the apps are installed in /usr/USER/bin…

runs fine from teh command line just need php/apache to be able to run teh same apps and have the same libs available.