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
First off, Imitaz, great job on the writeup and if anyone wants a recommendation for your work, they got it from me! You have done work for me in the past and have been awesome!
Have you tried lately to get this going on dreamhost?
I got ffmpeg going with h264 and some more 🙂
I can’t get ffmpeg-php installed. The latest version is 0.6.0 and it dies on
./configure –prefix=$HOME –libdir=$HOME/lib –bindir=$HOME/bin
with
. . .
checking whether to force gd support in ffmpeg-php… no
./configure: line 4770: syntax error near unexpected token `ffmpeg,’
./configure: line 4770: ` PHP_ADD_EXTENSION_DEP(ffmpeg, gd)’
bash-3.1$
I’m trying to upgrade FFMPEG to the latest version on my dreamhost shared server. I got stuck on the ./configure part of the FFMPEG step.
I input:
./configure “–prefix=$HOME” “–enable-cross-compile” “–enable-shared” “–enable-libmp3lame” “–extra-cflags=-I$HOME/include” “–extra-ldflags=-L$HOME/lib”
The output is:
“Must specify target arch and OS when cross-compiling
If you think configure made a mistake. make sure you are using the latest version from SVN. …”
What should I do? If I need to specify the target arch and OS where do I find that information.
hp/main -I/home/feidimy/include/php/TSRM -I/home/feidimy/include/php/Zend -I/home/feidi my/include/php/ext -I/home/feidimy/include/php/ext/date/lib -I/home/feidimy/include/ffm peg -DHAVE_CONFIG_H -g -O2 -Wall -fno-strict-aliasing -c /home/feidimy/php-5.3.0/ffmpeg -php-0.5.0/ffmpeg_frame.c -fPIC -DPIC -o .libs/ffmpeg_frame.o
/home/feidimy/php-5.3.0/ffmpeg-php-0.5.0/ffmpeg_frame.c: In function ‘_php_convert_fram e’:
/home/feidimy/php-5.3.0/ffmpeg-php-0.5.0/ffmpeg_frame.c:162: warning: implicit declarat ion of function ‘img_convert’
/home/feidimy/php-5.3.0/ffmpeg-php-0.5.0/ffmpeg_frame.c: In function ‘_php_crop_frame’:
/home/feidimy/php-5.3.0/ffmpeg-php-0.5.0/ffmpeg_frame.c:215: warning: implicit declarat ion of function ‘img_copy’
/home/feidimy/php-5.3.0/ffmpeg-php-0.5.0/ffmpeg_frame.c: In function ‘_php_resample_fra me’:
/home/feidimy/php-5.3.0/ffmpeg-php-0.5.0/ffmpeg_frame.c:237: error: ‘ImgReSampleContext ‘ undeclared (first use in this function)
/home/feidimy/php-5.3.0/ffmpeg-php-0.5.0/ffmpeg_frame.c:237: error: (Each undeclared id entifier is reported only once
/home/feidimy/php-5.3.0/ffmpeg-php-0.5.0/ffmpeg_frame.c:237: error: for each function i t appears in.)
/home/feidimy/php-5.3.0/ffmpeg-php-0.5.0/ffmpeg_frame.c:237: error: ‘img_resample_ctx’ undeclared (first use in this function)
/home/feidimy/php-5.3.0/ffmpeg-php-0.5.0/ffmpeg_frame.c:263: warning: implicit declarat ion of function ‘img_resample_full_init’
/home/feidimy/php-5.3.0/ffmpeg-php-0.5.0/ffmpeg_frame.c:276: warning: implicit declarat ion of function ‘img_resample’
/home/feidimy/php-5.3.0/ffmpeg-php-0.5.0/ffmpeg_frame.c:281: warning: implicit declarat ion of function ‘img_resample_close’
make: *** [ffmpeg_frame.lo] Error 1
what’s the error mean? i just left last step…
Hi Davidson,
I’ll need to look at the server to figure out the problem and comment on it.
ffmpreg
./configure “–prefix=$HOME” “–cross-compile” “–enable-shared” “–enable-mp3lame” “–extra-cflags=-I$HOME/include” “–extra-ldflags=-L$HOME/lib
did this
./configure “–prefix=$HOME” “–enable-cross-compile” “–enable-shared” “–enable-libmp3lame” “–extra-cflags=-I$HOME/include”
now the prob is file not found “–extra-cflags=-I$HOME/include”
and least and last
ffmpeg-php
manjula]$ make clean
make: *** No rule to make target `clean’. Stop.
[manjula]$ make install
make: *** No rule to make target `install’. Stop.
did this
[manjula]$ ./configure && make install
got this
> [manjula]$ ./configure && make install
> checking for grep that handles long lines and -e… /bin/grep
> checking for egrep… /bin/grep -E
> checking for a sed that does not truncate output… /bin/sed
> checking for cc… cc
> checking for C compiler default output file name… a.out
> checking whether the C compiler works… yes
> checking whether we are cross compiling… no
> checking for suffix of executables…
> checking for suffix of object files… o
> checking whether we are using the GNU C compiler… yes
> checking whether cc accepts -g… yes
> checking for cc option to accept ISO C89… none needed
> checking how to run the C preprocessor… cc -E
> checking for icc… no
> checking for suncc… no
> checking whether cc understands -c and -o together… yes
> checking for system library directory… lib
> checking if compiler supports -R… no
> checking if compiler supports -Wl,-rpath,… yes
> checking build system type… i686-pc-linux-gnu
> checking host system type… i686-pc-linux-gnu
> checking target system type… i686-pc-linux-gnu
> checking for PHP prefix… /home/clipperuser
> checking for PHP includes… -I/home/clipperuser/include/php -I/home/clipperuser/include/php/main -I/home/clipperuser/include/php/TSRM -I/home/clipperuser/include/php/Zend -I/home/clipperuser/include/php/ext -I/home/clipperuser/include/php/ext/date/lib
> checking for PHP extension directory… /home/clipperuser/lib/extensions/no-debug-non-zts-20090626
> checking for PHP installed headers prefix… /home/clipperuser/include/php
> checking if debug is enabled… no
> checking if zts is enabled… no
> checking for re2c… no
> configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
> checking for gawk… gawk
> checking for ffmpeg support… yes, shared
> checking for ffmpeg headers… configure: error: ffmpeg headers not found. Make sure you’ve built ffmpeg as shared libs using the –enable-shared option
-bash: checking: command not found
[manjula]$ [manjula]$ make clean
-bash: [manjula]$: command not found
[manjula]$ make: *** No rule to make target `clean’. Stop.
> [manjula]$ make install
> make: *** No rule to make target `install’. Stop.
> [manjula]$ manjula]$ make clean
now what???
i give up want to do this dreamhost with shell putty.exe ??? how much
im trying to install this on dreamhost not so dreamy..:) and im doing allright till i got to here
FFMPEG
svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
cd ffmpeg/ good till here *****
./configure “–prefix=$HOME” “–cross-compile” “–enable-shared” “–enable-mp3lame” “–extra-cflags=-I$HOME/include” “–extra-ldflags=-L$HOME/lib”
hers after two fixes
./configure “–prefix=$HOME” “–enable-cross-compile” “–enable-shared” “–enable-libmp3lame” “–extra-cflags=-I$HOME/include”
now th error is with “–extra-cflags=-I$HOME/include” am i in the wrong dir at this point or something?
want to fix it for me? how much I give up..:(
This article is a great idea, unfortunately it’s not working for me..
When I try to phpize ffmpeg-php, it tells me that autoconf isn’t installed. When I install autoconf, it seems okay(aka I get no errors) but isn’t recognized by anything. Also, where is the autoconf executable? I only see autoconf.m4
please let me know if this sounds familiar
Hello, when i try to install FFmpeg-PHP
./configure “–prefix=$HOME” “–libdir=$HOME/lib” “–bindir=$HOME/bin” “–with-ffmpeg=$HOME”
——————
checking for gawk… gawk
checking for ffmpeg support… yes, shared
checking for ffmpeg headers… configure: error: ffmpeg headers not found. Make sure you’ve built ffmpeg as shared libs using the –enable-shared option
Give me this error, why? because when i configure ffmpeg I use “–enable-shared” as in your tutorial.
might need to look at the server to get this working unless you already figured it out please ping me at netbrix at gmail dot com
I get the same error
some distributions of ffmpeg-php dont know where to look for the ffmpeg headers and look for them in a folder named ffmpeg within the include directory. assuming /usr/local/ is your prefix try this (change it for whatever your prefix is)
$ cp /usr/local/include/libavcodec/* /usr/local/include/ffmpeg
$ cp /usr/local/include/libavdevice/* /usr/local/include/ffmpeg
$ cp /usr/local/include/libavformat/* /usr/local/include/ffmpeg
$ cp /usr/local/include/libavutil/* /usr/local/include/ffmpeg
$ cp /usr/local/include/libswscale/* /usr/local/include/ffmpeg
that will copy the headers from the different lib folders into the ffmpeg folder and might(should) fix that problem.
hope that helps….
Just to give you some more information. I am using Putty and here is the transcript of where things went wrong for me:
[quote][rrhcg@p3nlh116 src]$ cd autoconf-2.60
[rrhcg@p3nlh116 autoconf-2.60]$ ./configure “–prefix=$HOME”
checking for a BSD-compatible install… /usr/bin/install -c
checking whether build environment is sane… yes
checking for gawk… gawk
checking whether make sets $(MAKE)… no
checking whether /bin/sh -n is known to work… yes
checking for expr… /usr/bin/expr
checking for gm4… no
checking for gnum4… no
checking for m4… /usr/bin/m4
checking whether m4 supports frozen files… yes
checking for perl… /usr/bin/perl
checking for emacs… emacs
checking whether emacs is sufficiently recent… yes
checking for emacs… emacs
checking where .elc files should go… ${datadir}/emacs/site-lisp
checking for grep that handles long lines and -e… /bin/grep
checking for egrep… /bin/grep -E
checking for a sed that does not truncate output… /bin/sed
configure: creating ./config.status
config.status: creating config/Makefile
config.status: creating tests/Makefile
config.status: creating tests/atlocal
config.status: creating man/Makefile
config.status: creating lib/emacs/Makefile
config.status: creating Makefile
config.status: creating doc/Makefile
config.status: creating lib/Makefile
config.status: creating lib/Autom4te/Makefile
config.status: creating lib/autoscan/Makefile
config.status: creating lib/m4sugar/Makefile
config.status: creating lib/autoconf/Makefile
config.status: creating lib/autotest/Makefile
config.status: creating bin/Makefile
config.status: executing tests/atconfig commands
[rrhcg@p3nlh116 autoconf-2.60]$ make
-bash: make: command not found[/quote]
Thanks again
you’re on a shared host which does not provide development tools like “make”
If you contact godaddy support to get the development tools installed they might be able to do it for you if not then switch to dreamhost or bluehost or some other shared host.
Hello and thanks for this great tutorial. I am on godaddy shared hosting and I am getting an error with the ‘make’ command
-bash: make: command not found
Any help would be appreciated. Thank you
Thanks for the idea Dhilip will surely consider
Add some donate button here
we can buy your server setup but we need to do our self also as learning
donation make you working
*Is this comment posted already?*
Hey Imtiaz, great tutorial btw…
I’ve tried all the steps and got stuck while installing ffmpeg-php.
It said that ffmpeg header not found, and the system told me that I have to make sure built ffmpeg as shared lib using the –enable-shared option, and I did it before got the warning. so It’s so curious why did it happen.
and I’ve tried to reinstall ffmpeg from the begining… and really make sure about the option, it was done. But while installing ffmpeg-php there’s same result, what should I do then, hope you can tell me the right soon..
FYI: I didn’t uninstall the ffmpeg to try this, so can you please tell me what’s the command to uninstall ffmpeg package?
Thanks.
Kind Regards,
Ihwan.
Isaac,
It looks like you’re missing the c++ compiler. Please have theh ost install the package gcc-cpp or gcc-c++
I think ive given setting this up a good enough. I mainly wanted to do it myself to learn. I would like you to set the rest of my failed attempt up but would really wanna know what you had to do to fix it. It’s more for my personal knowledge than for getting the site up. lemme know if you can quote me.
Hi i have this problem:
~/src/lame-3.97]$ ./configure “–prefix=$HOME” “–enable-shared”
checking build system type… i686-pc-linux-gnu
checking host system type… i686-pc-linux-gnu
checking for a BSD-compatible install… /usr/bin/install -c
checking whether build environment is sane… yes
checking for gawk… gawk
checking whether make sets $(MAKE)… yes
checking whether to enable maintainer-specific portions of Makefiles… no
checking for style of include used by make… GNU
checking for gcc… gcc
checking for C compiler default output file name… configure: error: C compiler cannot create executables
See `config.log’ for more details.
———————–
gcc
-jailshell: /usr/bin/gcc: Permission denied
what i have to do? thx
Hi coolest,
you need to edit your php.ini and change the path to the extension_dir to /home/cooolest/lib/php/extensions/no-debug-non-zts-20060613/
If you need help installing let me know.