Install ffmpeg-php on CentOS 6 with DirectAdmin
In this post, we will show you how to install ffmpeg and ffmpeg-php on a CentOS 6 VPS with a DirectAdmin control panel. FFmpeg is the leading multimedia framework capable of decoding, encoding, transcoding, recording, converting and streaming digital audio and video in various formats. ffmpeg-php is a PHP extension which is used for accessing and retrieving information from video and audio files from within PHP scripts.
First of all download and install RPMForge repository using the following commands:
[email protected]:~# wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.$(arch).rpm
[email protected]:~# rpm -Uvh rpmforge-release-0.5.3-1.el6.rf.$(arch).rpm
Now you can install FFmpeg and some additional packages using yum.
[email protected]:~# yum -y install ffmpeg ffmpeg-devel libogg libvorbis lame flvtool2 mencoder
To download and extract the ffmpeg-php tarball, run:
[email protected]:~# wget https://centos.googlecode.com/files/ffmpeg-php-0.6.0.tbz2
[email protected]:~# tar -xjf ffmpeg-php-0.6.0.tbz2 [email protected]:~# cd ffmpeg-php-0.6.0
Run ‘phpize’ to create the necessary build scripts
[email protected]:~# phpize
If you get an error message “phpize: command not found”, It means that phpize is not in the system PATH. In our case, using PHP FPM version 5.6 the full path to the phpize is ‘/usr/local/php56/bin/phpize’, so we need to run:
[email protected]:~# /usr/local/php56/bin/phpize
Run “configure” to set the installation options, in our case the command is as follows:
[email protected]:~# ./configure --with-php-config=/usr/local/php56/bin/php-config
You can find the locations of phpize and php-config binaries using the find command:
[email protected]:~# find /usr/local/ -type f -name
[email protected]:~# phpize find /usr/local/ -type f -name php-config
Run make to start the compilation:
[email protected]:~# make
If you get an error message like
make: *** [ffmpeg_movie.lo] Error 1 open the
ffmpeg_movie.c file and make the following changes:
[email protected]:~# vim ffmpeg_movie.c
list_entry *le; to
list_entry new_le; to
hashkey_length+1, (void *)&new_le, sizeof(list_entry), to
hashkey_length+1, (void *)&new_le,sizeof(zend_rsrc_list_entry),
and restart the compilation:
[email protected]:~# make
to install the binaries run:
[email protected]:~# make install
Once the installation is complete, open the php.ini file
[email protected]:~# vim /usr/local/php56/lib/php.ini
change the extension_dir to point to the extension directory, in our case :
and append the following line to enable the ffmpeg extension
Finally restart php-fpm for changes to take effect.
[email protected]:~# service php-fpm56 restart
If you’re running PHP as an Apache module, then restart apache with the command below:
[email protected]:~# service httpd restart
That’s it. You have successfully installed the ffmpeg-php extension.
Of course you don’t have to do any of this if you use one of our Linux VPS Hosting services, in which case you can simply ask our expert Linux admins to setup this for you. They are available 24×7 and will take care of your request immediately.
PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.