title: FFmpeg - PHP Error Code 127
body: <p>I am trying to execute FFmpeg from php. I have installed FFmpeg-php, and the extension is in the modules directory and it shows up in phpinfo. FFmpeg is working fine as I can run the command in a terminal and it outputs the video. However, when I try and run the command from php using the following script:</p>
  
  <pre><code>exec(ffmpeg -i input.avi output.avi);
  </code></pre>
  
  <p>But I get a '127' error code.</p>
  
  <p>The extension is loaded in using:</p>
  
  <pre><code>$extension      = "ffmpeg";
  $extension_soname   = $extension . "." . PHP_SHLIB_SUFFIX;
  $extension_fullname = PHP_EXTENSION_DIR . "/" . $extension_soname;
  
  // Locate Extension
  define('FFMPEG_LIBRARY', '/usr/local/bin/ffmpeg');
  
  // Load Extension
  if (!extension_loaded($extension))
      echo dl($extension_soname) or die("Can't load extension $extension_fullname\n");
  </code></pre>
  
  <p>I have also tried defining the aboslute extension location in the command:</p>
  
  <pre><code>exec(/usr/local/bin/ffmpeg-i input.avi output.avi);
  </code></pre>
  
  <p>Again, this works in the terminal but still returns the same erro code using the php exec().</p>
  
  <p>Has anyone got any ideas?</p>
  
  <p>Thank you.</p>