Setting environment vars for php exec + ffmpeg

software development


I’m trying to get a custom build of ffmpeg to work using the PHP exec() function, but it appears I am missing an environment variable somewhere, as exec won’t execute anything in my /home/[username]/bin folder. It just returns a 127 status message. Everything works as expected from the command prompt over SSH. I’m using a custom build of PHP with safe mode off and can show you my phpinfo() if you think it’ll be helpful.

Any idea how I can tell PHP to execute programs from that directory? I’ve tried putenv(‘PATH=/home/[username/bin’) and exec(“export PATH=/home/[username]/bin:$PATH”).