Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am not sure why so first here is the error

Array ( [0] => ffmpeg: error while loading shared libraries: failed to map segment from shared object: Permission denied ) 

my PHP

exec('ffmpeg -i /home/social/public_html/'.$key['upload_path'].' -threads 0  /home/social/public_html/'.$key['path'].$key['filename'].'.webm 2>&1',$out);

I also tried

exec('/usr/bin/ffmpeg -i /home/social/public_html/'.$key['upload_path'].' -threads 0  /home/social/public_html/'.$key['path'].$key['filename'].'.webm 2>&1',$out);

Now when I ssh into the server and run the same command it works fine.

here is my FFMPEG

ffmpeg version 1.0 Copyright (c) 2000-2012 the FFmpeg developers
  built on Oct 22 2012 19:38:33 with gcc 4.4.6 (GCC) 20120305 (Red Hat 4.4.6-4)
  configuration: --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvpx --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-gpl --enable-postproc --enable-nonfree
  libavutil      51. 73.101 / 51. 73.101
  libavcodec     54. 59.100 / 54. 59.100
  libavformat    54. 29.104 / 54. 29.104
  libavdevice    54.  2.101 / 54.  2.101
  libavfilter     3. 17.100 /  3. 17.100
  libswscale      2.  1.101 /  2.  1.101
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

Use -h to get full help or, even better, run 'man ffmpeg'

I am wondering if anyone else has this error

share|improve this question
up vote 1 down vote accepted

I assume you are trying to run the command through a web server. Because if you have verified that you php-command-invocation works by running php ffmpeg-invocation-script.php as "yourself", then the most likely cause of the error is wrong user permissions.

Your web server (apache?) is running as a different user than what you log in with. It is common to restrict access to video and audio devices to users who belong to groups video and audio. The easy solution to this is to add your apache or httpd user to those groups:

usermod -a -G apache video

To figure out who your apache is running as use this:

ps aux |grep [a]pache |tail -n1 | awk '{print $1}'

To list all groups on your system use (look for audio and video):

getent  group | sort | awk -F: '{print $1}'

Apart from that you may run into trouble running your ffmped from PHP becasue PHP scripts are usually restricted to run no longer than a given amount of time (30 sec or so). This is a parameter which you can edit in the apache-php config. On my system this is found here:

$ grep -Hn max_exec /etc/php/apache2-php5.3/php.ini
/etc/php/apache2-php5.3/php.ini:444:max_execution_time = 30

There are also memory limits. You will find the parameter for it in the same section as the max_execution_time parameter.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.