ffmpeg-phpを64bitなCentOS4にインストールする方法(怪しい)

<追記>こんなメッセージが出た。怪しい。

Compiler did not align stack variables. Libavcodec has been miscompiled
and may be very slow or crash. This is not a bug in libavcodec,
but in the compiler. Do not report crashes to FFmpeg developers.

</追記>

» ffmpeg-php http://ffmpeg-php.sourceforge.net/

このやり方が正しいかどうかはわからないけど、とりあえずインストールできて動いているので晒してみるよ。

64bitなCentOS4に、ffmpeg-develをyumでdagからinstallした上で、ffmpeg-phpphpizeしてconfigure。libavcodec.soが無いとおっしゃる。32bitなCentOS5では出なかったエラー。

[ffmpeg-php-0.5.1]$ phpize
[ffmpeg-php-0.5.1]$ ./configure
  :
checking for ffmpeg libavcodec.so... configure: error: ffmpeg share libraries not found. Make sure you've built ffmpeg as shared libs using the --enable-shared option

32bitなCentOS5ではlibavcodec.soは/usr/lib/libavcodec.soにあるけど、64bitなCentOS4ではlibavcodec.soは/usr/lib64/の中にある。

(phpizeで作られた)configureのlibavcodec.soを探索する部分が以下のようになっていた。

    for i in $PHP_FFMPEG /usr/local /usr ; do
      if test -f $i/lib/libavcodec.so; then
        FFMPEG_LIBDIR=$i/lib
        break
      fi
    done

prefixがついた上で、必ず「/lib/libavcodec.so」になってるっぽい。

そこで、ちょっと無理矢理感が漂うけど、以下のように修正。

*** 3276,3285 ****
--- 3276,3289 ----
    for i in $PHP_FFMPEG /usr/local /usr ; do
      if test -f $i/lib/libavcodec.so; then
        FFMPEG_LIBDIR=$i/lib
        break
      fi
+     if test -f $i/lib64/libavcodec.so; then
+       FFMPEG_LIBDIR=$i/lib64
+       break
+     fi
    done

    if test -z "$FFMPEG_LIBDIR"; then
      { { echo "$as_me:$LINENO: error: ffmpeg share libraries not found. Make sure you've built ffmpeg as shared libs using the --enable-shared option" >&5
  echo "$as_me: error: ffmpeg share libraries not found. Make sure you've built ffmpeg as shared libs using the --enable-shared option" >&2;} 

これでconfigureしてmakeしてmake install。php.iniにextension=ffmpeg.soを追記。apacheを再起動して動作確認。一応動作しているっぽいのでした。