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