title: ffmpeg won't save the file when executed from a php page
body: <p>I wrote few lines of codes today to  create an video from an image with ffmpeg.</p>
  
  <p>the command works well directly on my server and the file is saved at the good place, but when running it from PHP, the process goes, but the file won't save for some reason.</p>
  
  <p>Here is the code I use :</p>
  
  <pre><code>$ffmpegcmd= "/usr/bin/ffmpeg -loop 1 -y -i /home/mysite/www/forwork/simpletext.jpg -c:v libx264 -t 30 -pix_fmt yuv420p /home/mysite/www/forwork/movie.avi 2&gt;&amp;1";
  exec($ffmpegcmd, $output);  
  print_r($output);
  </code></pre>
  
  <p>And here is the answer I get :</p>
  
  <pre><code>Array ( [0] =&gt; ffmpeg version git-2015-09-06-db18b3d Copyright (c) 2000-2015 the FFmpeg developers 
  [1] =&gt; built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-16) 
  [2] =&gt; configuration: --prefix=/usr/ffmpeg_build --extra-cflags=-I/usr/ffmpeg_build/include --extra-ldflags=-L/usr/ffmpeg_build/lib --bindir=/usr/bin --pkg-config-flags=--static --enable-gpl --enable-nonfree --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 
  [3] =&gt; libavutil 55. 0.100 / 55. 0.100 
  [4] =&gt; libavcodec 57. 0.100 / 57. 0.100 
  [5] =&gt; libavformat 57. 0.100 / 57. 0.100 
  [6] =&gt; libavdevice 57. 0.100 / 57. 0.100 
  [7] =&gt; libavfilter 6. 0.100 / 6. 0.100 
  [8] =&gt; libswscale 4. 0.100 / 4. 0.100 
  [9] =&gt; libswresample 2. 0.100 / 2. 0.100 
  [10] =&gt; libpostproc 54. 0.100 / 54. 0.100 
  [11] =&gt; Input #0, image2, from '/home/mysite/www/forwork/simpletext.jpg': 
  [12] =&gt; Duration: 00:00:00.04, start: 0.000000, bitrate: 10414 kb/s 
  [13] =&gt; Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 1280x720 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 25 tbn, 25 tbc 
  [14] =&gt; /home/mysite/www/forwork/movie.avi: Permission denied )
  </code></pre>
  
  <p>I chmod the forwork directory to 755 but it won't change anything.</p>
  
  <p>help troubleshooting this would be greatly appreciate. Thanks</p>