# Ubuntu install php5-ffmpeg

When I try to install php5-ffmpeg:

apt-get install php5-ffmpeg


I get an error:

The following packages have unmet dependencies:
php5-ffmpeg : Depends: phpapi-20090626+lfs


As I understand my php5-ffmpeg was broken when I upgraded php from 5.3 to 5.4.

How can I fix it? I tried some options like -f, -ingnore-dependencies but that did not fix it.

I'm using Ubuntu 12.04.2 LTS.

• Try apt-get install php5-cgi first. – Nathan C May 29 '13 at 11:05
• php5-cgi is already the newest version. – Victor May 29 '13 at 15:57
• Did you add third party repositories/PPAs? Which ones? – Michael Hampton May 29 '13 at 17:50
• Well, I don't know how to check it. I don't remember whether I added or not, probably when I installed php 5.4 or maybe some other packages for LAMP I added some repos if they were mentioned in manuals... – Victor May 30 '13 at 4:20
• Hi, i have a same problem. you have managed to solve the problem? I installed php5.4 from ppa:ondrej/php5 repository. – Lughino Jul 1 '13 at 20:09

First try to resolve dependency using below PPA but this version is End Of Life, recommended to upgrade php-5.6

sudo add-apt-repository ppa:ondrej/php5-oldstable
sudo apt-get update


Then

sudo add-apt-repository ppa:mc3man/trusty-media
sudo apt-get update
sudo apt-get install ffmpeg ffmpeg-devel


Download php-ffmpeg from http://ffmpeg-php.sourceforge.net/ and extract.

cd ffmpeg-php-<version>
./configure
make
sudo make


Edit php.ini file and add this end of file :

extension=ffmpeg.so


Last week I successfully installed this extension on centos 6

• Please remember, that even php-5.6 is already a deprecated one. While php7 has some caveats on it's own - upgrade should be considered to latest LTS version. – BlackWebWolf Mar 30 '17 at 8:09

If you take a look at the official webpage for ffmpeg-php, you'll see the date of the last update is 2007. That's why it is recommended you don't use it on any production server, since you have to use an old version of ffmpeg together with ffmpeg-php, which is obviously not a good idea, considering the number of bug fixes created since 2007.

Perhaps a better solution would be to call ffmpeg/ffprobe directly from your web pages to do whatever you need with your audio/video. That way you'll have less of a headache keeping up with new updates of ffmpeg, since command line options usually don't change that much as the API/ABI does. For more help on using ffmpeg from web pages, you could read this tutorial on ffmpeg wiki:

Simple ffmpeg install is enough for using it in php files,but if still you need to install it then try to download files and compile them manually. check this for reference http://ffmpeg-php.sourceforge.net/

phpapi-20090626+lfs is a "virtual package" which another package may "provide". In your case, this is an older virtual package which php5-ffmpeg requires, and which the newer PHP package doesn't provide. The quickest solution just to get everything working, if the PHP upgrade broke it, would be to downgrade PHP.

For a solution using the new PHP, you will need an updated version of php5-ffmpeg, if that's available. I believe this is a package from an external repository (like a PPA), because I don't see it in the normal distribution repositories. If it isn't available, you'll have to try to build it yourself. That might not be possible with the updated versions of ffmpeg and PHP, though ...

Given the specifics of how old php5-ffmpeg is (as detailed here), I would try to change your application to avoid the use of this library in the first place, as it locks you in to (at least) an old version of ffmpeg.

In the mean time, the easiest solution, in my opinion, is to downgrade PHP (and ffmpeg, if necessary) to the supported version.