title: FFmpeg giving a wierd "Permission denied" error (Digitalocean VPS Ubuntu 18.04)
body: <p>I've set up a VPS server on Digitalocean. Installed Ubuntu 18.04, LAMP, etc.
  Finally, I installed ffmpeg. It is working fine from terminal but when I try to execute it through php it gives a weird &quot;Permission denied&quot; error:</p>
  <p>Here is some information:<br /><br />
  root@vl:/# whereis ffmpeg<br />
  ffmpeg: /usr/local/bin/ffmpeg<br />
  root@vl:/# whereis ffprobe<br />
  ffprobe: /usr/local/bin/ffprobe<br /></p>
  <p>root@vl:/# ffmpeg -version<br />
  ffmpeg version N-102461-g8649f5dca6 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
  configuration: --prefix=/usr/local/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/usr/local/ffmpeg_build/include --extra-ldflags=-L/usr/local/ffmpeg_build/lib --extra-libs='-lpthread -lm' --ld=g++ --bindir=/usr/local/bin --enable-gpl --enable-gnutls --enable-libaom --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libsvtav1 --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree
  libavutil      57.  0.100 / 57.  0.100
  libavcodec     59.  1.100 / 59.  1.100
  libavformat    59.  0.101 / 59.  0.101
  libavdevice    59.  0.100 / 59.  0.100
  libavfilter     8.  0.101 /  8.  0.101
  libswscale      6.  0.100 /  6.  0.100
  libswresample   4.  0.100 /  4.  0.100
  libpostproc    56.  0.100 / 56.  0.100
  <br /><br /></p>
  <p>My php file:<br /></p>
  
  echo shell_exec("ffmpeg -i mj.gif -profile:v baseline -pix_fmt yuv420p -vf scale=600:-2 output.mp4 2>&1")<br />
  ?><br /><br />
  <p>The ERROR!:<br />
  ffmpeg version N-102461-g8649f5dca6 Copyright (c) 2000-2021 the FFmpeg developers built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04) configuration: --prefix=/usr/local/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/usr/local/ffmpeg_build/include --extra-ldflags=-L/usr/local/ffmpeg_build/lib --extra-libs='-lpthread -lm' --ld=g++ --bindir=/usr/local/bin --enable-gpl --enable-gnutls --enable-libaom --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libsvtav1 --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree libavutil 57. 0.100 / 57. 0.100 libavcodec 59. 1.100 / 59. 1.100 libavformat 59. 0.101 / 59. 0.101 libavdevice 59. 0.100 / 59. 0.100 libavfilter 8. 0.101 / 8. 0.101 libswscale 6. 0.100 / 6. 0.100 libswresample 4. 0.100 / 4. 0.100 libpostproc 56. 0.100 / 56. 0.100 Input #0, gif, from 'mj.gif': Duration: 00:00:01.60, start: 0.000000, bitrate: 22863 kb/s Stream #0:0: Video: gif, bgra, 1400x1050, 10 fps, 10 tbr, 100 tbn output.mp4: Permission denied
  <br /><br />
  From the past 24 hours I've tried installing ffmpeg in different ways (compiling &amp; apt install), I've also tried changing the permission but still I'm stuck with this error.<br />
  Any help would be highly appreciated!<br />
  Thanks</p>