jfeniello Posted February 26, 2010 Share Posted February 26, 2010 Hi, I have a bash script i wrote to do a few things (copy some files, sed some text files, and execute a few apps (ffmpeg, cinelerra). I also have a php page that runs this bash script through exec(); If i run via the shell (su'd as apache) as: php myphppage.php it executes correctly, copying the files, sed replacements, executes ffmpeg and cinelerra as expected. When i hit myphppage.php via a browser, it executes, kicks off the .sh script, does the copies, runs ffmpeg, but when it runs cinelerra, it goes nuts, basically resulting in not running correctly, and creating a bunch (10ish) files in the working directory with names like ?, ?a`, p!2, etc. What i don't understand is what is different from being on ssh as user apache and running php mypage.php vs hitting mypage.php with a browser (since apache runs as user apache). I'll be happy to provide whatever additional information or files that may be helpful in solving this. Thanks -jim Quote Link to comment Share on other sites More sharing options...
roopurt18 Posted February 26, 2010 Share Posted February 26, 2010 I'm no guru in either linux or apache, but my understanding of bash is that when you run a bash script it creates a sub-shell that inherits environment settings of the current shell. My initial guess would be the environment when the script is run by apache is not the same as that when run from bash. I would assume things like stdin, stdout, and pipes would work the same, but like I said I'm no guru. As a step by step process to figure out what is happening, I would recreate the shell script as a new file with commands up to the point that it stops working. In other words, copy the script and remove all the commands that make it go nuts. Then try invoking those commands from the PHP script (accessed by apache). I guess what you really want to know is, Can cinelerra be invoked by PHP under Apache without problems just by itself? Quote Link to comment 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.