ffmpeg-php on dreamhost shared host

Please use the server setup page to request a quote.

How to install ffmpeg-php on a dreamhost shared host under a users account

This HOWTO now includes setup instructions for the following stuff:

  • autoconf
  • LAME
  • ffmpeg
  • GD2
  • mplayer+mencoder
  • Ruby
  • flvtool2
  • libogg
  • libvorbis
  • PHP
  • ffmpeg-php

Disclaimer: Some of you might not be able to make it all work due to various reasons, that does not mean it cannot be done.

For installation assistance please also read The install prerequisites page where we list the requirements for the server setup. Clip-share, vshare, alstrasoft, social media are all scripts which we have setup successfully on Dreamhost, Bluehost, godaddy and many other shared hosting environments (as on 10May2007)

Rayzz, PHPMotion and OSTube also successfully deployed on shared hosts (as on 10August 07)

Prepare the directory
structure
mkdir bin
mkdir lib
mkdir tmp
chmod 777 tmp
chmod 775 bin
chmod 775 lib

Export some environment
variables
export TMPDIR=$HOME/tmp
export PATH=$HOME/bin:$PATH
export LD_LIBRARY_PATH=$HOME/lib:/usr/local/lib:$LD_LIBRARY_PATH
export CPATH=$HOME/include:/usr/local/include:$CPATH
export LIBRARY_PATH=$HOME/lib:/usr/local/lib:$LIBRARY_PATH
mkdir src
cd src

AUTOCONF
wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.60.tar.gz
tar -zxf autoconf-2.60.tar.gz
cd autoconf-2.60
./configure "--prefix=$HOME"
make
make install

LAME

wget http://nchc.dl.sourceforge.net/sourceforge/lame/lame-3.97.tar.gz
tar -zxvf lame-3.97.tar.gz
cd lame-3.97
./configure "--prefix=$HOME" "--enable-shared"
make
make install

LIBOGG

wget http://downloads.xiph.org/releases/ogg/libogg-1.1.3.tar.gz
tar -zxf
libogg-1.1.3.tar.gz
cd libogg-1.1.3
./configure --prefix=$HOME
make
make install

LIBVORBIS

wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.1.2.tar.gz
tar -zxf libvorbis-1.1.2.tar.gz
cd libvorbis-1.1.2
./configure --prefix=$HOME
make
make install

FFMPEG

svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
cd ffmpeg/
./configure "--prefix=$HOME" "--cross-compile" "--enable-shared" "--enable-mp3lame" "--extra-cflags=-I$HOME/include" "--extra-ldflags=-L$HOME/lib"
make
make install

GD2

wget http://www.boutell.com/gd/http/gd-2.0.33.tar.gz
tar -zxf gd-2.0.33.tar.gz
cd gd-2.0.33
./configure --prefix=$HOME
make
make install

MPlayer + Mencoder

wget http://www3.mplayerhq.hu/MPlayer/releases/codecs/essential-20061022.tar.bz2
bunzip2 essential-20061022.tar.bz2
tar -xf essential-20061022.tar
mv essential-20061022 $HOME/lib
wget http://www3.mplayerhq.hu/MPlayer/releases/MPlayer-1.0rc1.tar.bz2
bunzip2 MPlayer-1.0rc1.tar.bz2
tar -xf MPlayer-1.0rc1.tar
cd MPlayer-1.0rc1
./configure --prefix=$HOME --with-codecsdir=$HOME/lib/essential-20061022
make
make install

RUBY
cd $HOME/src
wget ftp://ftp.ruby-lang.org/pub/ruby/stable-snapshot.tar.gz
tar -zxf stable-snapshot.tar.gz
cd ruby
make distclean
./configure --prefix=$HOME
make
make install

FLVTOOL2

wget http://rubyforge.org/frs/download.php/9225/flvtool2_1.0.5_rc6.tgz
tar -zxvf flvtool2_1.0.5_rc6.tgz
cd flvtool2_1.0.5_rc6
ruby setup.rb config –prefix=$HOME
ruby setup.rb setup
ruby setup.rb install

PHP
wget http://us2.php.net/distributions/php-4.4.4.tar.bz2
bunzip2 php-4.4.4.tar.bz2
tar xf php-4.4.4.tar
cd php-4.4.4
./configure --prefix=$HOME --libdir=$HOME/lib --bindir=$HOME/bin --with-ffmpeg=$HOME
make
make install

FFMPEG-PHP
wget http://superb-east.dl.sourceforge.net/sourceforge/ffmpeg-php/ffmpeg-php-0.5.0.tbz2
bunzip2 ffmpeg-php-0.5.0.tbz2
tar -xf ffmpeg-php-0.5.0.tar
cd ffmpeg-php-0.5.0
phpize
./configure "--prefix=$HOME" "--libdir=$HOME/lib" "--bindir=$HOME/bin" "--with-ffmpeg=$HOME"
make clean
make install

Setup users environment
to use the php installed earlier

cd $HOME/lib
cp $HOME/lib/php/extensions/no-debug-non-zts-20020429/ffmpeg.so ./
cp $HOME/src/php-4.4.4/php.ini-recommended php.ini
vi php.ini (add extension= /home//lib/ffmpeg.so)</STRONG>< /STRONG>

To enable site:
cp $HOME/bin/php $HOME/cgi-bin/php.cgi

add a .htaccess with following content

AddHandler phpFive .php
Action phpFive /cgi-bin/php.cgi

You might need to also run the following

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/lib
” export LIBRARY_PATH=
$HOME/lib:$LIBRARY_PATH”
“export
CPATH=$HOME/include/:$HOME/include/lame/”

as well as put it ahead of any
call to ffmpeg in your PHP code. Please send questions through the sitecontact form
.-Imtiaz (khanimtiaz at gmail dot com)

We have got this procedure working on a variety
of shared hosts besides dreamhost. For installation assistance please also read
the install prerequisites page

73 thoughts on “ffmpeg-php on dreamhost shared host”

  1. The 404 error only occurs with MENCODER… and again the PHPize dosnt work….. also tried the export…. AUTOconf installed fine… over and over again!!!

  2. HI, i am having the same problem that Beni had when i phpize ffmpeg-php. I tried “export PHP_AUTOCONF=autoconf” but that didn’t seem to do anything. Am i not doing it right? Which directory do i need to be in when i do it? What exactly does it do, because i am getting the same results.

    Thanks, this is a great guide!

  3. Hello, I need help. All steps ok, but when I will compile ffmpeg-php I get this error at make install:

    make: *** [ffmpeg-php.lo] Error 1

    warning: `ImgReSampleContext’ is deprecated
    warning: `ImgReSampleContext’ is deprecated
    `AVFrac’ is deprecated (
    php.h: No such file or directory
    php_ini.h: No such file or directory
    php_globals.h: No such file or directory
    ext/standard/info.h: No such file or directory
    In file included from /home/jack/ffmpeg-php-0.5.0/ffmpeg-php.c:33
    error: syntax error before “ffmpeg_module_entry”
    error: conflicting types for ‘av_register_all’
    error: conflicting types for ‘register_ffmpeg_movie_class’
    and others…

  4. Hire Imtiaz for all your problems… he did a great(and cheap) job of setting this up for me without a glitch. I use php5, so I didnt want the php ffmpeg package, and he still worked it out.

    Thanks man!

  5. Hi,

    I find my problem, I was using script phpshell and wasn’t been able to do anything…
    But now I used putty and it all went well in installation process(I think so).

    But now I have new problem I get this error message when I setup my youtube clone site and try to upload some movie… this is the error I get, don’t quite understand what it meens:

    Fatal error: Cannot instantiate non-existent class: ffmpeg_movie in /home/.matzoh/xxxx/auto-purchasing-tips.com/video/upload.php

    Can anyone help or advice on this matter??

    Nemanja

  6. I see nobody answered me… 🙁

    I have problem installing mp3lame on dreamhost
    The shared object is not seen during configuration of mencoder

    see the post above

    Waiting for your reply ASAP

  7. Hi Nemanja,
    The $HOME in –prefix=$HOME, is an environment variable which translates into /home/dxxx/ on your dreamhost server (the .matzoh will be removed). I am constantly updating this document as it gets me a lot of hits and a number of small installation jobs so please go ahead and ask questions I’ll try and make the doc as helpful as possible.

    Also if you would like to have me set up your server please contact me through the contact form and use your real email id when doing so.

    Warm Regards
    Imtiaz

  8. Just so I don’t forget:

    On bluehost:
    1…. mencoder should be installed last
    2…. u need ffmpeg
    3…. CPATH
    export PATH=$HOME/bin:$PATH
    export CPATH=$HOME/include/:$HOME/include/lame/
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/lib
    export LIBRARY_PATH=$HOME/lib:$LIBRARY_PATH

    4…. Sleep
    5…. for flvtool2 u need ot first install ruby
    wget ftp://ftp.ruby-lang.org/pub/ruby/ruby-1.8.5-p12.tar.gz
    tar -zxf ruby-1.8.5-p12.tar.gz
    cd ruby-1.8.5-p12
    ./configure –prefix=$HOME
    make
    make install
    cd ../flvtool2_1.0.5_rc6
    $HOME/bin/ruby setup.rb config –prefix=$HOME
    $HOME/ruby setup.rb setup
    $HOME/ruby setup.rb install

    It just might save the day someday… 🙂

  9. Hi,

    I have tryed to compile and install the ffmpeg and ffmpeg-php and I have much truble doing it, so I did a search in google and find Your site which explain this installation, but need more info on it.

    Would like to know is this install info is for shared hosting or for dedicted hosting, because I’m in shared hosting on dreamhost and don’t have permissions to write on /home dir…

    I encounter error installing autoconf…
    I seems to have compiled it, but when I try to install it I get this error

    usr/bin/install: cannot create regular file `/bin/autom4te’: Permission denied
    /usr/bin/install: cannot create regular file `/bin/autoconf’: Permission denied
    /usr/bin/install: cannot create regular file `/bin/autoheader’: Permission denied
    /usr/bin/install: cannot create regular file `/bin/autoreconf’: Permission denied
    /usr/bin/install: cannot create regular file `/bin/ifnames’: Permission denied
    /usr/bin/install: cannot create regular file `/bin/autoscan’: Permission denied
    /usr/bin/install: cannot create regular file `/bin/autoupdate’: Permission denied
    make[2]: *** [install-binSCRIPTS] Error 1
    make[1]: *** [install-am] Error 2
    make: *** [install-recursive] Error 1

    It seems like I haven’t permissiom to make dir or any thing else on home dir, so the question is how I gona install something in here???

    This is what I would like to know:
    What this meens “–prefix=$HOME” in ./configure “–prefix=$HOME” don’t understand is this relative or apsolute path, what I have to enter here ????
    My apsolute path is /home/.matzoh/dxxx/auto-purchasing-tips.com/video/

    I saw that many others have the same problems and it would be nice if you explain a litle bit more detailed about that home prefix and what goes where because something is not working like in David case You said that he fix it but You didn’t explain what exactly He fixed and I think this would be of great help to every one..

    If anyone have such problem and he/she solved it, please post the explained problem solving right here thanks,

    Nemanja

  10. I installed eveything but when i try to install ffmpeg-php and then run phpize, it say autoconf not found. As you mentioned above to reinstall autoconf, i did three times but still the same problem. please please can someone help me just a bit. as im really broke these days and i cannot pay anyone to install it for me. so any help i would be appriciate it.
    ——————————————————————-

    And Imtiaz thanks for your help, i tried the way you told me but again im stuch with the autoconf anot found.

    thank you in advance

  11. I have compiled the ffmpeg (old version) and compiled the lame and added the amr codecs to the ffmpeg and enabled mp3lame while compiling

    but when I try to compile the mplayer
    I see the following error in the configuration log …
    Although the so file is in the lib folder

    what should I do?
    ============ Checking for libmp3lame (for mencoder) ============

    #include
    int main(void) { lame_version_t lv; (void) lame_init(); get_lame_version_numerical(&lv); printf(“%d%d\n”,lv.major,lv.minor); return 0; }

    cc -O4 -march=athlon-xp -mcpu=athlon-xp -pipe -ffast-math -fomit-frame-pointer -I/home//include -I/usr/X11R6/include -I/usr/include/freetype2 -L/home//lib -o /home//tmp/mplayer-conf-19371-12812.o /home//tmp/mplayer-conf-19464-12812.c -lmp3lame -lm

    ldd /home//tmp/mplayer-conf-19371-12812.o
    libmp3lame.so.0 => not found
    libm.so.6 => /lib/libm.so.6 (0x40021000)
    libc.so.6 => /lib/libc.so.6 (0x40043000)
    /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)

    /home//tmp/mplayer-conf-19371-12812.o: error while loading shared libraries: libmp3lame.so.0: cannot open shared object file: No such file or directory
    Result is: no
    ##########################################

  12. Hi Beni,
    Please go through this document. The folder structure is clearly explained at the top, the src folder will hold all the source to build the components. If you think something is confusing please let me know and I’ll go ahead and change it.

    -Imtiaz

  13. Hello, can anyone please tell me the folder structure; How and where to put the files? do they go into (src) folder or what? I would much appriciate it.

    thank you.

  14. Hi have compiled everything above the ffmpeg, but i dont see to compile ffempeg itself. I’m a newbie to this so i really tried to figure out things but no luck. I get an sort of error.

    Here it is:
    ————–
    Unable to create and execute files in /tmp. Set the TMPDIR environment
    variable to another directory and make sure that /tmp is not mounted
    noexec.
    Sanity test failed.
    If you think configure made a mistake, make sure you are using the latest
    version from SVN. If the latest version fails, report the problem to the
    ffmpeg-devel@mplayerhq.hu mailing list or IRC #ffmpeg on irc.freenode.net.
    Include the log file “config.err” produced by configure as this will help
    solving the problem.
    ———————–

    What does it mean? What do i do here?

    I would absolutely appriciate it if anyone could help me out here please.

    Thank you,

    Dann

  15. Hi Arda,
    The trick is to install LAME first and then install ffmpeg with LAME support.
    And the name is Imtiaz, David is one of the people whom I’ve set this up for 🙂

  16. there is a small mistake with dashes in ./configuration line. It must be like this;
    ffmpeg

    svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
    cd ffmpeg/
    ./configure –-prefix=$HOME –-cross-compile –-enable-shared
    make
    make install

  17. David had a problem with autoconf which was resolved by reinstalling autoconf and then completing the install as directed in the document. It’s working now at uploadartist dot com

  18. Hi

    I’m trying to install ffmpeg-php on dreamhost

    I followed your instructions, however, when I came to the step to install ffmpeg-php when I use the phpize command the following error message

    Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF environment variable is set correctly and then rerun this script.

    When i try to configure ffmpeg it says it is an invalid file or directory.

    I’m not too sure about the structure of the files are they all in the root of the directory with the exception of php 4?

  19. Hi I get the error message “Cannot find autoconf.” when trying to use the command “phpize” in the step of installing ffmpeg-php

    Can anyone help?

Leave a Reply

Your email address will not be published. Required fields are marked *