search
Categories
Sponsors
VirtualMetric Hyper-V Monitoring, Hyper-V Reporting
Archive
Blogroll

Badges
MCSE
Community

Cozumpark Bilisim Portali
Installing FFmpeg-PHP on CPanel and Centos 6 on Hyper-V
Posted in Linux Server, Virtual Machine Manager | 12 Comments | 35,749 views | 08/10/2011 12:23

Before installing FFmpeg-PHP, you need to install FFmpeg, MPlayer and MEncoder for video processing.
I posted an installation guide for them. You can reach it from this post:

Because I have CPanel on my CentOS, I won’t install Apache, MySQL or PHP. I’m just going with FFmpeg-PHP installation.
If you need Ruby on Rails, you can also install it via CPanel scripts.

So I assume you did previous installations. Now let’s go with FFmpeg-PHP installation.

1. Download ffmpeg-php in to /usr/src directory.

1
2
cd /usr/src
wget http://downloads.sourceforge.net/project/ffmpeg-php/ffmpeg-php/0.6.0/ffmpeg-php-0.6.0.tbz2?r=&ts=1365651935&use_mirror=garr

2. Untar the ffmpeg-php package.

tar xjf ffmpeg-php-0.6.0.tbz2

3. Use phpize to create config files.

1
2
cd ffmpeg-php-0.6.0
phpize

4. Now we can configure, make and make install.

1
2
3
./configure –enable-shared –prefix=/usr
make
make install

5. Go to php.ini file and ffmpeg.so as extension.

nano /usr/local/lib/php.ini

6. Let’s check our info.php file.

ffmpeg

ffmpeg-php version => 0.6.0-svn
ffmpeg-php built on => Oct 8 2011 11:49:39
ffmpeg-php gd support => disabled
ffmpeg libavcodec version => Lavc52.72.2
ffmpeg libavformat version => Lavf52.64.2
ffmpeg swscaler version => SwS0.11.0

Directive => Local Value => Master Value
ffmpeg.allow_persistent => 0 => 0
ffmpeg.show_warnings => 0 => 0

Now you have ffmpeg-php on your CPanel and CentOS 6 installation on Hyper-V. Congrats!


Comments (12)

Gurminder Singh

November 5th, 2011
01:43:49

getting this error when running ./configure

root@server [/usr/src/ffmpeg-php-0.6.0]# ./configure .enable-shared .prefix=/usr
configure: WARNING: you should use –build, –host, –target
configure: error: invalid variable name: .prefix


admin

November 5th, 2011
09:33:02

Hello Gurminder,

There is a copy/past issue i guess. That should be:

./configure –enable-shared –prefix=/usr

Check the article again.

Yusuf.


Sandeep

November 14th, 2011
08:13:06

Hi I am getting following error

IG_H -g -O2 -Wall -fno-strict-aliasing -c /sandy/ffmpeg-php-0.6.0/ffmpeg_frame.c -fPIC -DPIC -o .libs/ffmpeg_frame.o
/sandy/ffmpeg-php-0.6.0/ffmpeg_frame.c: In function âzim_ffmpeg_frame_toGDImageâ:
/sandy/ffmpeg-php-0.6.0/ffmpeg_frame.c:336: error: âPIX_FMT_RGBA32â undeclared (first use in this function)
/sandy/ffmpeg-php-0.6.0/ffmpeg_frame.c:336: error: (Each undeclared identifier is reported only once
/sandy/ffmpeg-php-0.6.0/ffmpeg_frame.c:336: error: for each function it appears in.)
/sandy/ffmpeg-php-0.6.0/ffmpeg_frame.c: In function âzim_ffmpeg_frame_ffmpeg_frameâ:
/sandy/ffmpeg-php-0.6.0/ffmpeg_frame.c:421: error: âPIX_FMT_RGBA32â undeclared (first use in this function)
make: *** [ffmpeg_frame.lo] Error 1


admin

November 14th, 2011
10:52:45

Hello Sandeep,

Open ffmpeg_frame.c for edit.

nano ffmpeg_frame.c

Find the following:

PIX_FMT_RGBA32

Replace with this:

PIX_FMT_RGB32

Continue installation:

cd /usr/local/src/ffmpeg-php-0.6.0
cp -aP ffmpeg_frame.loT ffmpeg_frame.lo
make clean
./configure
make
make install

It should work.

Yusuf.


uzman

December 20th, 2011
08:06:54

I am getting this error:

/usr/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:1284: error: âAVCodecContextâ has no member named âhurry_upâ
/usr/src/ffmpeg-php-0.6.0/ffmpeg_movie.c: In function â_php_get_sample_aspect_ratioâ:
/usr/src/ffmpeg-php-0.6.0/ffmpeg_movie.c:1443: error: âCODEC_TYPE_VIDEOâ undeclared (first use in this function)


Z__o__R

February 10th, 2012
05:39:19

checking build system type… Invalid configuration `enable-shared’: machine `enable’ not recognized
configure: error: /bin/sh ./config.sub enable-shared failed


Echizen

March 30th, 2012
21:25:26

Hello, many thanks for writing this guide,
unfortunately, I got this error when installing ffmpeg-php

/usr/local/src/ffmpeg-installer/ffmpeg-php-0.6.0/ffmpeg_movie.c: In function â_php_get_av_frameâ:
/usr/local/src/ffmpeg-installer/ffmpeg-php-0.6.0/ffmpeg_movie.c:1246: error: âCODEC_TYPE_VIDEOâ undeclared (first use in this function)
/usr/local/src/ffmpeg-installer/ffmpeg-php-0.6.0/ffmpeg_movie.c:1282: error: âAVCodecContextâ has no member named âhurry_upâ
/usr/local/src/ffmpeg-installer/ffmpeg-php-0.6.0/ffmpeg_movie.c:1284: error: âAVCodecContextâ has no member named âhurry_upâ
/usr/local/src/ffmpeg-installer/ffmpeg-php-0.6.0/ffmpeg_movie.c: In function â_php_get_sample_aspect_ratioâ:
/usr/local/src/ffmpeg-installer/ffmpeg-php-0.6.0/ffmpeg_movie.c:1443: error: âCODEC_TYPE_VIDEOâ undeclared (first use in this function)
make: *** [ffmpeg_movie.lo] Error 1

My ffmpeg installation is ffmpeg version git-2012-03-30-d3d5e84
and my ffmpeg-php is version 0.6.0
and my php itself is version 5.3.10

could you help fix this issue? :s
Thanks in advance


hi

June 11th, 2012
13:34:00

I’m getting error make: *** [ffmpeg_movie.lo] Error 1


Brad Rothman

July 19th, 2012
02:34:59

Any pointers as how to fix this issue? Cant find much through searching google…

In file included from /usr/include/sys/stat.h:107,
from /usr/local/include/php/main/php_streams.h:28,
from /usr/local/include/php/main/php.h:400,
from /app/ffmpeg-php-0.6.0/ffmpeg-php.c:40:
/usr/include/bits/stat.h:91: error: field âst_atimâ has incomplete type
/usr/include/bits/stat.h:92: error: field âst_mtimâ has incomplete type
/usr/include/bits/stat.h:93: error: field âst_ctimâ has incomplete type
In file included from /usr/local/include/php/main/php_streams.h:28,
from /usr/local/include/php/main/php.h:400,
from /app/ffmpeg-php-0.6.0/ffmpeg-php.c:40:
/usr/include/sys/stat.h:367: error: array type has incomplete element type
/usr/include/sys/stat.h:374: error: array type has incomplete element type
In file included from /usr/local/include/php/main/php.h:406,
from /app/ffmpeg-php-0.6.0/ffmpeg-php.c:40:
/usr/local/include/php/TSRM/tsrm_virtual_cwd.h:218: error: expected specifier-qualifier-list before âtime_tâ
/usr/local/include/php/TSRM/tsrm_virtual_cwd.h:246: error: expected declaration specifiers or â…â before âtime_tâ
/app/ffmpeg-php-0.6.0/ffmpeg-php.c: In function âzm_startup_ffmpegâ:
/app/ffmpeg-php-0.6.0/ffmpeg-php.c:94: warning: implicit declaration of function âavcodec_initâ
make: *** [ffmpeg-php.lo] Error 1


italya

September 21st, 2012
19:33:22

hello, i have problem with this:

[/usr/local/src/ffmpeg-php-0.5.3]# make
/bin/sh /usr/local/src/ffmpeg-php-0.5.3/libtool –mode=compile cc -I. -I/usr/local/src/ffmpeg-php-0.5.3 -DPHP_ATOM_INC -I/usr/local/src/ffmpeg-php-0.5.3/include -I/usr/local/src/ffmpeg-php-0.5.3/main -I/usr/local/src/ffmpeg-php-0.5.3 -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/usr/local/include/libavcodec/ -I/usr/local/include/libavformat/ -I/usr/local/include/libavutil/ -I/usr/local/include/libswscale/ -I/usr/local/include/libavfilter/ -I/usr/local/include/libavdevice/ -DHAVE_CONFIG_H -g -O2 -Wall -fno-strict-aliasing -c /usr/local/src/ffmpeg-php-0.5.3/ffmpeg-php.c -o ffmpeg-php.lo
mkdir .libs
cc -I. -I/usr/local/src/ffmpeg-php-0.5.3 -DPHP_ATOM_INC -I/usr/local/src/ffmpeg-php-0.5.3/include -I/usr/local/src/ffmpeg-php-0.5.3/main -I/usr/local/src/ffmpeg-php-0.5.3 -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -I/usr/local/include/libavcodec/ -I/usr/local/include/libavformat/ -I/usr/local/include/libavutil/ -I/usr/local/include/libswscale/ -I/usr/local/include/libavfilter/ -I/usr/local/include/libavdevice/ -DHAVE_CONFIG_H -g -O2 -Wall -fno-strict-aliasing -c /usr/local/src/ffmpeg-php-0.5.3/ffmpeg-php.c -fPIC -DPIC -o .libs/ffmpeg-php.o
In file included from /usr/include/sys/stat.h:105,
from /usr/local/include/php/main/php_streams.h:28,
from /usr/local/include/php/main/php.h:405,
from /usr/local/src/ffmpeg-php-0.5.3/ffmpeg-php.c:40:
/usr/include/bits/stat.h:88: error: field âst_atimâ has incomplete type
/usr/include/bits/stat.h:89: error: field âst_mtimâ has incomplete type
/usr/include/bits/stat.h:90: error: field âst_ctimâ has incomplete type
In file included from /usr/local/include/php/main/php.h:411,
from /usr/local/src/ffmpeg-php-0.5.3/ffmpeg-php.c:40:
/usr/local/include/php/TSRM/tsrm_virtual_cwd.h:218: error: expected specifier-qualifier-list before âtime_tâ
/usr/local/include/php/TSRM/tsrm_virtual_cwd.h:246: error: expected declaration specifiers or â…â before âtime_tâ
/usr/local/src/ffmpeg-php-0.5.3/ffmpeg-php.c: In function âzm_startup_ffmpegâ:
/usr/local/src/ffmpeg-php-0.5.3/ffmpeg-php.c:91: warning: implicit declaration of function âavcodec_initâ
/usr/local/src/ffmpeg-php-0.5.3/ffmpeg-php.c:110: warning: implicit declaration of function âavcodec_buildâ
/usr/local/src/ffmpeg-php-0.5.3/ffmpeg-php.c: In function âzm_shutdown_ffmpegâ:
/usr/local/src/ffmpeg-php-0.5.3/ffmpeg-php.c:121: warning: implicit declaration of function âav_free_staticâ
make: *** [ffmpeg-php.lo] Error 1

can you help me please?


Maypudd

January 28th, 2013
23:53:51

It seems a lot of people (including me) are having trouble with errors after running ‘make’. The error usually starts out with:

/usr/include/bits/stat.h:91: error: field âst_atimâ has incomplete type
/usr/include/bits/stat.h:92: error: field âst_mtimâ has incomplete type
/usr/include/bits/stat.h:93: error: field âst_ctimâ has incomplete type

and ends with:

Warning: implicit declaration of function âavcodec_initâ

If anyone can shed light on how to fix this, please let us know.

Thanks.


edho

February 5th, 2013
12:41:31

The avcodec problem can be solved by changing ffmpeg-php.c line 94 to avcodec_register_all(); This because avcodec_init(); is not supported anymore in ffmpeg.

However then still the other errors are there and have no solution for those (yet)

In file included from /usr/include/sys/stat.h:107,
from /usr/include/php/main/php_streams.h:28,
from /usr/include/php/main/php.h:396,
from /downloads/ffmpeg-php-0.6.0/ffmpeg-php.c:40:
/usr/include/bits/stat.h:91: error: field âst_atimâ has incomplete type
/usr/include/bits/stat.h:92: error: field âst_mtimâ has incomplete type
/usr/include/bits/stat.h:93: error: field âst_ctimâ has incomplete type
/usr/include/bits/stat.h:152: error: field âst_atimâ has incomplete type
/usr/include/bits/stat.h:153: error: field âst_mtimâ has incomplete type
/usr/include/bits/stat.h:154: error: field âst_ctimâ has incomplete type
In file included from /usr/include/php/main/php_streams.h:28,
from /usr/include/php/main/php.h:396,
from /downloads/ffmpeg-php-0.6.0/ffmpeg-php.c:40:
/usr/include/sys/stat.h:367: error: array type has incomplete element type
/usr/include/sys/stat.h:374: error: array type has incomplete element type
In file included from /usr/include/php/main/php.h:402,
from /downloads/ffmpeg-php-0.6.0/ffmpeg-php.c:40:
/usr/include/php/TSRM/tsrm_virtual_cwd.h:218: error: expected specifier-qualifier-list before âtime_tâ
/usr/include/php/TSRM/tsrm_virtual_cwd.h:246: error: expected declaration specifiers or â…â before âtime_tâ
make: *** [ffmpeg-php.lo] Error 1

if anyone knows how to solve this I would be grateful



Leave a Reply