FFMPEG-PHP INSTALL Of function ‘avcodec_init’ make: * [ffmpeg-php.lo] Error 1 SOLVED

Merhaba Arkadaşlar,

Birkaç gün önce forum üzerinden iletilen ffmpeg-php ile ilgili bir hatayla epeyce araştırma yapınca bir kez daha fark ettim artık internet gerçekten bilgi çöplüğü haline gelmiş.. Her neyse.. Dün akşam saatlerinden günün ilk saatlerine kadar uğraştıktan sonra problemi çözmenin verdiği rahatlık ve huzur içerisinde uyku moduna geçmeden önce sizlerle de paylaşmak istedim.

Ayrıca bu arada FFMPEG yetkilileriyle de paylaştım buradan bakabilirsiniz.

FFMPEG kurulumuna değinmeyeceğim çünkü bununla ilgili bir çok blogda makale var zaten.

Bu makaleyi okuyor olduğunuza göre büyük bir ihtimalle ilgili hatadan dolayı buraya gelmiş olmalısınız ama yine de kısaca ffmpeg-php kurulumundan söz edelim:

ffmpeg-php kurulumu / ffmpeg-php install

  • mkdir /srv/build
  • cd /srv/build
    
  • wget http://downloads.sourceforge.net/project/ffmpeg-php/ffmpeg-php/0.6.0/ffmpeg-php-0.6.0.tbz2
    (şu an güncel olan sürüm yukarıdaki adreste mevcut, kontrol etmek için buraya / current version bakabilirsiniz.)
    
  • tar -xjf ffmpeg-php-0.6.0.tbz2
    
  • cd ffmpeg-php-0.6.0/
    
  • phpize
    
  • ./configure
  • make
  • install

Linux CentOS 6.x (x86_64işletim sisteminde SSH üzerinde # make komutundan sonra aşağıdaki hatayla karşılaşabilirsiniz;

FFMPEG-PHP HATA / ERROR:
make: * [ffmpeg-php.lo] Error 1

/usr/include/php/TSRM/tsrm_virtual_cwd.h:212: error: expected specifier-qualifier-list before ‘time_t
/usr/include/php/TSRM/tsrm_virtual_cwd.h:240: error: expected declaration specifiers or ‘…’ before ‘time_t
/srv/build/ffmpeg-php-0.6.0/ffmpeg-php.c: In function ‘zm_startup_ffmpeg’:
/srv/build/ffmpeg-php-0.6.0/ffmpeg-php.c:94: warning: implicit declaration of function ‘avcodec_init’
make* [ffmpeg-php.lo] Error 1

FFMPEG-PHP Hata Detay / Error detail:

/bin/sh /srv/build/ffmpeg-php-0.6.0/libtool –mode=compile cc -I. -I/srv/build/ffmpeg-php-0.6.0 -DPHP_ATOM_INC -I/srv/build/ffmpeg-php-0.6.0/include -I/srv/build/ffmpeg-php-0.6.0/main -I/srv/build/ffmpeg-php-0.6.0 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/include/libavcodec/ -I/usr/include/libavformat/ -I/usr/include/libavutil/ -I/usr/include/libswscale/ -I/usr/include/libavfilter/ -I/usr/include/libavdevice/ -DHAVE_CONFIG_H -g -O2 -Wall -fno-strict-aliasing -c /srv/build/ffmpeg-php-0.6.0/ffmpeg-php.c -o ffmpeg-php.lo
libtool: compile: cc -I. -I/srv/build/ffmpeg-php-0.6.0 -DPHP_ATOM_INC -I/srv/build/ffmpeg-php-0.6.0/include -I/srv/build/ffmpeg-php-0.6.0/main -I/srv/build/ffmpeg-php-0.6.0 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/include/libavcodec/ -I/usr/include/libavformat/ -I/usr/include/libavutil/ -I/usr/include/libswscale/ -I/usr/include/libavfilter/ -I/usr/include/libavdevice/ -DHAVE_CONFIG_H -g -O2 -Wall -fno-strict-aliasing -c /srv/build/ffmpeg-php-0.6.0/ffmpeg-php.c -fPIC -DPIC -o .libs/ffmpeg-php.o
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:405,
from /srv/build/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:405,
from /srv/build/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:411,

from /srv/build/ffmpeg-php-0.6.0/ffmpeg-php.c:40:

/usr/include/php/TSRM/tsrm_virtual_cwd.h:212: error: expected specifier-qualifier-list before ‘time_t’
/usr/include/php/TSRM/tsrm_virtual_cwd.h:240: error: expected declaration specifiers or ‘…’ before ‘time_t’
/srv/build/ffmpeg-php-0.6.0/ffmpeg-php.c: In function ‘zm_startup_ffmpeg’:
/srv/build/ffmpeg-php-0.6.0/ffmpeg-php.c:94: warning: implicit declaration of function ‘avcodec_init’
make: * [ffmpeg-php.lo] Error 1

SEBEP / CAUSE

Derleme hataları / Compilation errors / This is a BUG!

CÖZÜM / SOLUTION 

  • git clone https://github.com/tony2001/ffmpeg-php.git
    
  • cd ffmpeg-php
    
  • phpize
    
  • ./configure
    
  • make && make install

    php.ini içerisine extension = ffmpeg.so eklemeyi ve servisleri yeniden başlatmayı unutmayın!

     

  • service httpd restart
  • okay lest go ;)

 

Kaynak/source: https://github.com/tony2001/ffmpeg-php/issues/1

 

 

SSH üzerinden “FFMEG ne durumda?” diye bakmak isterseniz; komut satırına;

# ffmpeg <- yazmanız yeterli olacaktır, bunun üzerine size aşağıdaki gibi bir yanıt verecektir.

ffmpeg version N-65847-g554d819-syslint Copyright (c) 2000-2014 the FFmpeg developers

built on Aug 23 2014 19:36:38 with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-4)
configuration: –prefix=/usr/local/cpffmpeg –enable-shared –enable-nonfree –enable-gpl –enable-pthreads –enable-libopencore-amrnb –enable-decoder=liba52 –enable-libopencore-amrwb –enable-libfaac –enable-libmp3lame –enable-libtheora –enable-libvorbis –enable-libx264 –enable-libxvid –extra-cflags=-I/usr/local/cpffmpeg/include/ –extra-ldflags=-L/usr/local/cpffmpeg/lib –enable-version3 –extra-version=syslint
libavutil 54. 7.100 / 54. 7.100
libavcodec 56. 0.101 / 56. 0.101
libavformat 56. 2.100 / 56. 2.100
libavdevice 56. 0.100 / 56. 0.100
libavfilter 5. 0.103 / 5. 0.103
libswscale 3. 0.100 / 3. 0.100
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 0.100 / 53. 0.100

Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]… {[outfile options] outfile}…

____________________________________________________________________________

My VPS: CentOS 6.5 x86_64
PHP V: PHP 5.3.3
FFMPEG: Installed

Step step install ffmpeg-php:
# phpize

Configuring for:
PHP Api Version: 20090626
Zend Module Api No: 20090626
Zend Extension Api No: 220090626

# ./configure
..
..
# make
/usr/include/php/TSRM/tsrm_virtual_cwd.h:212: error: expected specifier-qualifier-list before ‘time_t’
/usr/include/php/TSRM/tsrm_virtual_cwd.h:240: error: expected declaration specifiers or ‘…’ before ‘time_t’
/srv/build/ffmpeg-php-0.6.0/ffmpeg-php.c: In function ‘zm_startup_ffmpeg’:
/srv/build/ffmpeg-php-0.6.0/ffmpeg-php.c:94: warning: implicit declaration of function ‘avcodec_init’
make: * [ffmpeg-php.lo] Error 1

make error details:

/bin/sh /srv/build/ffmpeg-php-0.6.0/libtool –mode=compile cc -I. -I/srv/build/ffmpeg-php-0.6.0 -DPHP_ATOM_INC -I/srv/build/ffmpeg-php-0.6.0/include -I/srv/build/ffmpeg-php-0.6.0/main -I/srv/build/ffmpeg-php-0.6.0 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/include/libavcodec/ -I/usr/include/libavformat/ -I/usr/include/libavutil/ -I/usr/include/libswscale/ -I/usr/include/libavfilter/ -I/usr/include/libavdevice/ -DHAVE_CONFIG_H -g -O2 -Wall -fno-strict-aliasing -c /srv/build/ffmpeg-php-0.6.0/ffmpeg-php.c -o ffmpeg-php.lo
libtool: compile: cc -I. -I/srv/build/ffmpeg-php-0.6.0 -DPHP_ATOM_INC -I/srv/build/ffmpeg-php-0.6.0/include -I/srv/build/ffmpeg-php-0.6.0/main -I/srv/build/ffmpeg-php-0.6.0 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/include/libavcodec/ -I/usr/include/libavformat/ -I/usr/include/libavutil/ -I/usr/include/libswscale/ -I/usr/include/libavfilter/ -I/usr/include/libavdevice/ -DHAVE_CONFIG_H -g -O2 -Wall -fno-strict-aliasing -c /srv/build/ffmpeg-php-0.6.0/ffmpeg-php.c -fPIC -DPIC -o .libs/ffmpeg-php.o
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:405,
from /srv/build/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:405,
from /srv/build/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:411,

from /srv/build/ffmpeg-php-0.6.0/ffmpeg-php.c:40:

/usr/include/php/TSRM/tsrm_virtual_cwd.h:212: error: expected specifier-qualifier-list before ‘time_t’
/usr/include/php/TSRM/tsrm_virtual_cwd.h:240: error: expected declaration specifiers or ‘…’ before ‘time_t’
/srv/build/ffmpeg-php-0.6.0/ffmpeg-php.c: In function ‘zm_startup_ffmpeg’:
/srv/build/ffmpeg-php-0.6.0/ffmpeg-php.c:94: warning: implicit declaration of function ‘avcodec_init’
make: * [ffmpeg-php.lo] Error 1

configure: error: no acceptable C compiler found in $PATH See `config.log’ for more details.

Merhaba Arkadaşlar,

HATA: configure: error: no acceptable C compiler found in $PATH See `config.log’ for more details.

SSH üzerinde işlem yaparken siz de yukarıdaki hata ile karşılaşırsanız çözüm için aşağıdaki ssh komutunu çalıştırmanız yeterli olacaktır.

ÇÖZÜM: CentOS işletim sistemi için: # yum -y install gcc
                 Fedora işletim sistemi için:  # up2date -i gcc