ToonMariner Posted October 31, 2007 Share Posted October 31, 2007 Hi guys n' gals... My firts post in here and I wanr you I AM A TOTAL SPAZ at this stuff... Anyway working on a site hosted by Dreamhost. Its video stuff so I have installed mencoder ffmpeg flvtool2 lame etc etc. I have a couple of questions... I can run the mencoder from the command line successfully BUT when I run it from a php exec command it doesn't work. Each time I login I have to enter the folowing so that the correct apps are used... 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 Now I need to set the PATH permanently - I did post on the forums on there and a guy replied saying I shoudl look at Invocation in men bash... Problem being that I would LOVE to know what the hell he is on about. Apologies but if anyone could be so kind I kinda need a hand holding session on this... Thanks you lovely lovely people. Quote Link to comment https://forums.phpfreaks.com/topic/75520-path/ Share on other sites More sharing options...
effigy Posted October 31, 2007 Share Posted October 31, 2007 I think he means putting all of this into a bash script and calling it with arguments. Does the command actually need all of these paths, or do you just need to specify the full path when referencing the command in PHP? Quote Link to comment https://forums.phpfreaks.com/topic/75520-path/#findComment-382062 Share on other sites More sharing options...
rajivgonsalves Posted October 31, 2007 Share Posted October 31, 2007 you'll have to make a shell script setting all those variables and running the command and call that shell script from php (export only works for the current envoked session) Quote Link to comment https://forums.phpfreaks.com/topic/75520-path/#findComment-382083 Share on other sites More sharing options...
trq Posted October 31, 2007 Share Posted October 31, 2007 You can set variables perminently in your .bashrc file. I can run the mencoder from the command line successfully BUT when I run it from a php exec command it doesn't work. PHP usually runs as the Apache user or something simular, so setting the variables in your .bashrc won't make any difference. You simply need to pass the full path to the executables. eg; <?php exec('/usr/local/bin/ffmpeg foo'); ?> Quote Link to comment https://forums.phpfreaks.com/topic/75520-path/#findComment-382283 Share on other sites More sharing options...
ToonMariner Posted November 3, 2007 Author Share Posted November 3, 2007 thanks for the tips chaps. @thorpe I am passing the full path to app but it is still failing. The apps I have installed run fine in command line but php just can't seem to call them and I can't for the life of figure why. ANY ideas will be VERY welcome... Thanks everyone Quote Link to comment https://forums.phpfreaks.com/topic/75520-path/#findComment-384474 Share on other sites More sharing options...
effigy Posted November 4, 2007 Share Posted November 4, 2007 If the program needs variables set then you need to either: 1. Create a "wrapper" script that sets these variables and calls the program; or 2. Send them with the command, e.g., system('VAR=VALUE; cmd');. Quote Link to comment https://forums.phpfreaks.com/topic/75520-path/#findComment-384612 Share on other sites More sharing options...
ToonMariner Posted November 5, 2007 Author Share Posted November 5, 2007 TA V MUCH! got it running now Quote Link to comment https://forums.phpfreaks.com/topic/75520-path/#findComment-384715 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.