Compile ffmpeg-php for PHP 5.3 (Yes – it DOES work!)

Search Google for a version of ffmpeg-php that works with PHP 5.3 and you will find nothing useful. In fact there are many sites where people claim that it does not work with PHP 5.3. Well, they’re wrong! It’s not the easiest thing to get to work but it DOES work with PHP 5.3. (Scroll down for download link to my version of ffmpeg.so)

I am using Zend Server version of PHP 5.3 on Ubuntu 9.10 RC, this is what I did:

1. Install PHP sources (not 100% sure if this is actually required): sudo apt-get install php-5.3-source-zend-server.
2. Install build tools: sudo apt-get install build-essential
3. Install autoconf: sudo apt-get install autoconf
4. Install ffmpeg: sudo apt-get install ffmpeg
5. Install dev/header packages required to build: sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libgd2-xpm-dev
6. Download latest ffmpeg-php source:



7. tar xjf ffmpeg-php-0.6.0.tbz2
8. cd ffmpeg-php-0.6.0
9. (Zend Server – Optional) PATH=$PATH:/usr/local/zend/bin
10. phpize (produces LOADS of warnings, ignore, this is fine)
11. ./configure –enable-skip-gd-check
12. make
13. Copy ./modules/ffmpeg.so into PHP extensions directory or location of your choice
14. Add to php.ini or custom ini file: extension=ffmpeg.so
15. Restart the web server.

ffmpeg-php is now installed!

Download compiled ffmpeg.so file here: ffmpeg-php-0.6.0-php5.3.tar.gz

This is from my phpinfo:

PHP 5.3 with ffmpeg-php

Share

20 thoughts on “Compile ffmpeg-php for PHP 5.3 (Yes – it DOES work!)”

    1. Hi Michael,

      I would guess you would need to compile the extension on Windows to get it to work. As far as I remember extensions on Windows are compiled as DLL files rather than the SO files used on Linux. PHP extensions are written in C so I would guess a C compiler such as Visual Studio C++ would work.

  1. am running php 5.3.3, did exaclty what u have above

    keep getting this

    [root@25115_2_71849_311688 ffmpeg-php-0.6.0]# php
    PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/lib64/php/modules/ffmpeg.so’ – /usr/lib64/php/modules/ffmpeg.so: undefined symbol: _php_create_ffmpeg_frame in Unknown on line 0

    any ideas?

    1. If you download one of the pre-compiled versions I have on my site, they should work without issue with PHP 5.3.3.
      Alternatively I can grab you the 5.3.3 version of ffmpeg.so file from Ubuntu 10.10 beta and email it if you like.

  2. I followed the guide but it still fails on:
    src/ffmpeg-php-0.6.0/ffmpeg_frame.c -fPIC -DPIC -o .libs/ffmpeg_frame.o
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_frame.c: In function ‘zim_ffmpeg_frame_toGDImage’:
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_frame.c:336: error: ‘PIX_FMT_RGBA32’ undeclared (first use in this function)
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_frame.c:336: error: (Each undeclared identifier is reported only once
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_frame.c:336: error: for each function it appears in.)
    /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_frame.c: In function ‘zim_ffmpeg_frame_ffmpeg_frame’:
    /usr/local/src/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

    Debian squeeze with php 5.3

    1. [[ make: *** [ffmpeg_frame.lo] Error 1 ]] >> solve
      Rename all files extesion from *.loT to *.lo >> my enlgish is pool 🙂 but this solve after hours from googling

  3. Hey Phil,

    Just wanted to confirm “As far as I remember extensions on Windows are compiled as DLL files rather than the SO files used on Linux” – you are absolutely correct.

    And thanks to the poster Nick above. Very useful!!

    -DM

Leave a Reply