Set 30 2008
Install ffmpeg, PHP and eAccelerator on Dreamhost
I recently had to install ffmpeg on a Dreamhost VPS client, but I’m sure that as long as you have shell access, you will be able to install it on any host. You don’t even need to have root access.
If you are looking for a way to install ffmpeg, follow the steps bellow and you will have no problems, as this is an exact transcription of what I did, and I had no problems.
But first, take a look at the requirements:
- 200 MB of free space
- Shell access to your Linux server
Here is a php info preview from this installation:
Let’s proceed, download sharedhostffmpeg.v1.0.2 (tar.gz). This is a bash script coded by Sherin, that will handle all the hard work for you.
After download, upload it for your server, to your root directory (thats the “/” directory).
Now, log in to shell and type:
tar -xvzf sharedhostffmpeg102tar.gz cd sharedhostffmpeg102tar.gz sh install.sh
At this point, go for a walk and leave the script running….
When you come back, about 45 minutes should have passed, and you should see a screen like this in your SSH client:
Now, rule #1: DO NOT follow the on screen instructions!
Instead go back to your FTP client, and download to your PC the php-bin binary file at the /bin folder.

Download php-cgi file troght FTP
Now, go to the root of the website you wish to install ffmpeg, that’s probably something like:
/ /yoursite.com (go inside this directory, your site's directory)
Once there, create a folder called cgi-bin
/ /yoursite.com/cgi-bin
Chmod the cgi-bin folder to 0755.
Set your FTP client transfer type to binary mode.

Changing transfer type to binary in CuteFTP
Now upload the php-cgi file you’ve previously downloaded to your PC, into the cgi-bin folder
/ /yoursite.com/cgi-bin/php-cgi
Rename php-cgi to php.fcgi
/ /yoursite.com/cgi-bin/php.fcgi
Go back to the FTP root directory, it’s now time to install eAccelerator.
Open your favorite editor, create a new document, copy and paste this piece of code.
#!/bin/bash # Abort on any errors set -e # ***Don't pick a directory that already exists!*** We clean up after # ourselves at the end! SRCDIR=${HOME}/source # DON'T change this!! INSTALLDIR=${HOME} # Set DISTDIR to somewhere persistent, if you plan to muck around with this # script and run it several times! DISTDIR=${HOME}/dist # Pre-download clean up!!!! rm -fr $SRCDIR $DISTDIR # Update version information here. AUTOCONF="autoconf-2.61" AUTOMAKE="automake-1.9.6" EAC="eaccelerator-0.9.5.3" # What PHP features do you want enabled? EACFEATURES="--prefix=${INSTALLDIR} \ --enable-eaccelerator=shared \ --with-php-config=$PHP_PREFIX/bin/php-config" # Push the install dir's bin directory into the path export PATH=${INSTALLDIR}/bin:$PATH #setup directories mkdir -p ${SRCDIR} mkdir -p ${INSTALLDIR} mkdir -p ${DISTDIR} cd ${DISTDIR} # Get all the required packages wget -c http://ftp.gnu.org/gnu/autoconf/${AUTOCONF}.tar.gz wget -c http://ftp.gnu.org/gnu/automake/${AUTOMAKE}.tar.gz wget -c http://bart.eaccelerator.net/source/0.9.5.3/${EAC}.tar.bz2 echo ---------- Unpacking downloaded archives. This process may take several minutes! ---------- cd ${SRCDIR} # Unpack them all echo Extracting ${AUTOCONF}... tar xzf ${DISTDIR}/${AUTOCONF}.tar.gz echo Done. echo Extracting ${AUTOMAKE}... tar xzf ${DISTDIR}/${AUTOMAKE}.tar.gz echo Done. echo Extracting ${EAC}... tar -xjf ${DISTDIR}/${EAC}.tar.bz2 echo Done. export PATH=${SRCDIR}/bin:$PATH export PHP_PREFIX=${INSTALLDIR}/bin # Build them in the required order to satisfy dependencies. #AUTOCONF cd ${SRCDIR}/${AUTOCONF} ./configure --prefix=${SRCDIR} # make clean make make install #AUTOMAKE cd ${SRCDIR}/${AUTOMAKE} ./configure --prefix=${SRCDIR} # make clean make make install #EAC cd ${SRCDIR}/${EAC} $PHP_PREFIX/phpize ./configure --enable-eaccelerator=shared --with-eaccelerator-info --with-php-config=$PHP_PREFIX/php-config # make clean make #copy config file; verify path with path in PHP.INI (if specified)! cp modules/eaccelerator.so ${INSTALLDIR}/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so mkdir -p ~/tmp/eaccelerator rm -fr $SRCDIR $DISTDIR echo ---------- INSTALL COMPLETE! ----------
This is another bash script, based on another one that I found here, but I’ve re-update it to fit our needs, and also becouse the original would not work for me.
Save it to FTP as installeAccelerator.sh
/ /installeAccelerator.sh
Go back to your SSH client and type:
cd sh installeAccelerator.sh
This should take a few minutes to install.
After it finishes the install, go to your Dreamhost panel and set your domain settings to use:
“PHP 5″, “FastCGI Support”, “Use FastCGI for all PHP”. Ok, this is probably not needed, but lets play safe.
We’re almost done!
We now need to tell our PHP that we’ve installed eAccelarator. To do so, we are going to edit the PHP.INI, this is located at /etc

PHP.INI file location in CuteFTP
Open it, and almost at the end and before add:
[eaccelerator] extension="eaccelerator.so" eaccelerator.allowed_admin_path="/home/user/yoursite.com" eaccelerator.shm_size="16" eaccelerator.cache_dir="/home/user/tmp/eaccelerator" eaccelerator.enable="1" eaccelerator.optimizer="1" eaccelerator.check_mtime="1" eaccelerator.debug="0" eaccelerator.filter="" eaccelerator.shm_max="0" eaccelerator.shm_ttl="0" eaccelerator.shm_prune_period="0" eaccelerator.shm_only="0" eaccelerator.compress="1" eaccelerator.compress_level="9"
Notice the eaccelerator.allowed_admin_path=”/home/user/yoursite.com”, you must fill it with your own path, the complete path to your domain.
You can add as many domains as you want, all you need is to add more lines like this:
eaccelerator.allowed_admin_path="/home/user/yoursite.com" eaccelerator.allowed_admin_path="/home/user/mysite.com" eaccelerator.allowed_admin_path="/home/user/oursite.com" (etc...)
Now, create a .htaccess file with the following:
Options +ExecCGI AddHandler fastcgi-script fcg fcgi fpl AddHandler php5-fastcgi .php Action php5-fastcgi /cgi-bin/php.fcgi
Next step is important, especially when you have lots of traffic on your site, on the site we are doing the installation, temporarily rename yourdomain.com to _yourdomain.com
This acts almost like a KILL command to every incoming connections, so we can saftly change from the servers PHP to our custom PHP.
Upload the htaccess you’ve just created to _yourdomain.com directory
/ /_yourdomain.com/.htaccess
Now, rename _yourdomain.com back to yourdomain.com
Upload a php file with the following:
Point your browser to that file, and if everything went ok, than it should be up and running.
Verify if eAccelerator and ffmpeg are installed:
*On the image it points the dir cache to /tmp/eaccelerator, it’s wrong, when you successfully install eaccelerator it will point to /home/user/tmp/eaccelerator
That’s it, Happy Coding!
Não perca os meus artigos! Subscreva a minha feed RSS.




Outubro 21st, 2008 at 18:50
Alright I am getting ffmpeg and ffmpeg-php in phpinfo and from command line it seems to work. But when using clipbucket I put my paths as /home/dingersusername/bin/ffmpeg … etc and it will not convert any suggestions.
Outubro 22nd, 2008 at 23:02
Hi Dinger, sorry for the late reply.
It’s hard to say Dinger. Are you hosted with dreamhost? If so, I think you can use the server’s ffmpeg and still access the custom installed ffmpeg-php, just configure your path as ‘ffmpeg’ (with no quotes of course).
If you still can’t get it to work, it’s probably some missing codec in ffmpeg, and without it, it can’t handle the conversion.
Give my first hint a try and let me know if it worked for you.
Novembro 5th, 2008 at 00:22
Man.. I can’t get this to work for the life of me.. GD WILL NOT compile.. no matter what I do!! It keeps failing with a libiconv error:
./.libs/libgd.so: undefined reference to `libiconv_open’
./.libs/libgd.so: undefined reference to `libiconv_close’
./.libs/libgd.so: undefined reference to `libiconv’
It makes me want to cry..
All the things I have tried on the web don’t work.. like adding LDFLAGS to the .compile string..
Any ideas?
Dezembro 11th, 2008 at 17:25
I get this error message:
The requested URL /cgi-bin/php.fcgi/info.php was not found on this server.
at: http://uiopluss.no/info.php what’s wrong ?
Dezembro 11th, 2008 at 18:39
Hi Eric!
You need to rename “php-fcgi” to “php.fcgi” on your cgi-bin folder.
And don’t forget to chmod 755 that folder.
Dezembro 14th, 2008 at 03:11
Thank you very much for this wonderful script. Now I see that its’s php 2.5.3. How can I change it so that i can install php 2.5.6 and also libmcrypt,libxml,libxslt, openssl and so on.. I chacked the script and I think I should play with start.sh and then add a script to each library. am i right? do you have any play to upgrade php’s version?
Dezembro 16th, 2008 at 23:59
I cannot thank you enough for posting this helpful tutorial! It has taken me so many attempts to install ffmpeg on DreamHost. So many tutorials and the like, and I have only gotten so far after hours of trying and teaching myself bits of linux commands. I’m running the installer right now, I’ll see how it goes
Dezembro 17th, 2008 at 00:33
You’re welcome Becca!
I really hope that everything install smoothly… I’m sure it will.
Just post here any issues you may have.
@Eric Winther
You need to modify the php.sh file and point the _DOWNLOAD_URL variable and _package variables to the desired php version.
It may be kind of tricky, as you have or comment out this line in the php.sh file:
I’ll add to the article an entire screen-shot or PDF print with the complete php info of this installation.
Janeiro 25th, 2009 at 17:53
Iceburn,
Any ideas on how to enable CURL with Sherins installer?
Or anyone? I would really appreciate it.
Cheers
Dinger
Abril 22nd, 2009 at 16:32
The sources in the install file (http://downloads.sherin.in/sources) are no longer applicable – I went ahead and grep’d for them, and there’s quite a few places you use this source…
GNU has quite a few (http://ftp.gnu.org/gnu/*toolname*/) but not all…any hopes for a change/modification to fix this?
Maio 8th, 2009 at 13:14
eaccelerator would probably require a webserver restart to begin caching. I did a setup recently and kept seeing false like so:
Caching Enabled false
Optimizer Enabled false
Rest of it was pretty much ok infact even the caching directories get made fine. So I went into panel made a small change to the hosting setup saved it and went back in and reverted the change….. idea being to make it restart apache to apply those changes and voila false bacame true….. try it out if you see that happen…. i see you do the rename website folder to _domainname and then revert i didnt do that maybe that would also amount to the same as restart… not sure….
Maio 13th, 2009 at 21:04
I think
cd sharedhostffmpeg102tar.gz
should be
cd sharedhostffmpeg.1.0.2/
Setembro 1st, 2009 at 08:23
Thanks a lot for your assistance!