PHPMotion Installation Tricks

The following instructions only apply to Version 2 of PHPmotion. For V1 please refer to the instructions provided inside the downloaded zip file

1. Download the the zipped file from PHPmotion, the version for PHP 5.x is the one which will work on our servers:
http://downloads.phpmotion.com/V2/PHPMOTION_PHP5.zip

2. Unzip the files on your computer
3. Using your web hosting control panel, create a mysql database and write down the details of the database once created
4. Upload all the phpmotion files into your FTP folder
5. CHMOD all the following files and directories to 777

* /pictures
* /classes
* /temp
* /logs
* /addons
* /uploads
* /uploads/avi
* /uploads/thumbs
* /uploads/audio
* /uploads/audio/temp
* /uploads/pictures

6. CHMOD all the following files and directories to 755
* /cgi-bin/all files in there
* /cgi-bin/audio/all files in there

7. Start the installation wizard by going to http://YOUDOMAIN.COM/setup (replace with your real domain name)

IMPORTANT NOTES

1. The following files MUST be uploaded in BINARY mode. Your FTP program will have an option for this
* /classes/config.php
* /watchingnow.php
* /mp3_id3_utils.php

Howto upload file to FTP Server in Binary Mode

I recently had to ftp some files to my webhost, using binary mode. I use either Dreamweaver or FileZilla for all my FTP needs. For my recent uploading, I chose FileZilla, but didn’t know at first how to upload in “binary” format.

Since then, I have leaned how this is done, and thought it may be prudent to share what I have learned. First, open Filezilla and connect to your server. You will have to enter the name of your ftp server, from your webhost. It will look something like “yourname@ftp.yourdomain.com” where “yourname” is whatever you use to sign in to CPanel. If you are trying to upload in binary format, you probably already know how to upload in the default ASCII, but thought it might be helpful if you are used to another FTP program and just beginning to learn how to use FileZilla.

After entering your FTP server name, enter the username and password you use for your webhost. Once you have logged in, use your mouse to direct your pointer to “transfer” in the top toolbar. Under “transfer,” you will see a few different options. Choose “transfer type” and then select “Binary.”

Highlight all the files and folders you want from your hard drive (local site), and drag them into the field containing the directories on your web host (remote site). Use the “Shift” button on your keyboard to choose many files/folders in a row, or use the “Ctrl” button (Cmd on a MAC) to selectively choose folders while skipping over others.

Since I have been spending more time blogging than creating templates, I haven’t been opening Dreamweaver often. If I ever learn how to use Dreamweaver to upload in “binary” format, I will post another blog. In the meantime, I hope this article will be helpful to somebody.

Installing FFmpeg, FFmpeg-php, Mencoder, Flv2tool, Mplayer

A few people have asked for this to be done so heres a howto for installing:

FFmpeg
FFmpeg-PHP
Mplayer + Mencoder (mencoder is now built into the mplayer svn release )
flv2tool ****REQUIRES RUBY ON RAILS****
LAME MP3 Encoder
Libogg
Libvorbis


+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++


**** UPDATED 10 FEBRUARY 2008 ****


CODE
cd /usr/local/src
#GET CRAP:
wget http://www3.mplayerhq.hu/MPlayer/releases/codecs/essential-20061022.tar.bz2 # ( UPDATED 20070308 )
wget http://rubyforge.org/frs/download.php/9225/flvtool2_1.0.5_rc6.tgz
wget http://easynews.dl.sourceforge.net/sourceforge/lame/lame-3.97.tar.gz
wget http://superb-west.dl.sourceforge.net/sourceforge/ffmpeg-php/ffmpeg-php-0.5.0.tbz2
wget http://downloads.xiph.org/releases/ogg/libogg-1.1.3.tar.gz
wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.1.2.tar.gz
#EXTRACT THE CRAP:
tar zxvf flvtool2_1.0.5_rc6.tgz
tar zxvf lame-3.97.tar.gz
tar zxvf libogg-1.1.3.tar.gz
tar zxvf libvorbis-1.1.2.tar.gz
tar zxvf flvtool2_1.0.5_rc6.tgz
tar jxvf essential-20061022.tar.bz2 # ( UPDATED 20070308 )
tar jxvf ffmpeg-php-0.5.0.tbz2
#WE NEED A DIR MADE:
mkdir /usr/local/lib/codecs/
#JUST IN CASE:
up2date -i gcc gmake make libcpp libgcc libstdc++ gcc4 gcc4-c++ gcc4-gfortran
yum install gcc gmake make libcpp libgcc libstdc++ gcc4 gcc4-c++ gcc4-gfortran
#WE NEED TO INSTALL SVN + ROR:
up2date -i subversion
up2date -i ruby
up2date -i ncurses-devel
svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer
cd /usr/local/src/mplayer
svn update
cd /usr/local/src
#COPY CODECS FOR MPLAYER:
mv /usr/local/src/essential-20061022/* /usr/local/lib/codecs/
chmod -R 755 /usr/local/lib/codecs/
#SECURE TMP IS A PAIN AT TIMES Wink
mkdir /usr/local/src/tmp
chmod 777 /usr/local/src/tmp
export TMPDIR=/usr/local/src/tmp
#LAME:
cd /usr/local/src/lame-3.97
./configure
make && make install
cd /usr/local/src/
#LIBOGG:
cd /usr/local/src/libogg-1.1.3
./configure && make && make install
cd /usr/local/src/
#LIBVORBIS:
cd /usr/local/src/libvorbis-1.1.2
./configure && make && make install
cd /usr/local/src/
#FLVTOOL2:
cd /usr/local/src/flvtool2_1.0.5_rc6/
ruby setup.rb config
ruby setup.rb setup
ruby setup.rb install
cd /usr/local/src/
cd /usr/local/src/mplayer
./configure && make && make install
cd /usr/local/src/
#FFMPEG:
cd /usr/local/src/ffmpeg/
#./configure --enable-libmp3lame --enable-libogg --enable-libvorbis --disable-mmx --enable-shared
### configure options changed ###
./configure --enable-libmp3lame --disable-mmx --enable-shared
######### IGNORE THIS ECHO LINE The dev's fixed the issue in svn. Im only leaveing it here in case it comes up again ###############
#####echo '#define HAVE_LRINTF 1 '>>config.h
################################################################################
#############################
make
make install
ln -s /usr/local/lib/libavformat.so.50 /usr/lib/libavformat.so.50
ln -s /usr/local/lib/libavcodec.so.51 /usr/lib/libavcodec.so.51
ln -s /usr/local/lib/libavutil.so.49 /usr/lib/libavutil.so.49
ln -s /usr/local/lib/libmp3lame.so.0 /usr/lib/libmp3lame.so.0
ln -s /usr/local/lib/libavformat.so.51 /usr/lib/libavformat.so.51
ln -s /usr/local/lib/libavformat.so.52 /usr/lib/libavformat.so.52
ln -s /usr/local/lib/libavdevice.so.52 /usr/lib/libavdevice.so.52
cd /usr/local/src/
#FFMPEG-PHP:
cd /usr/local/src/ffmpeg-php-0.5.0/
yum -y install autoconf
up2date -i autoconf
phpize
./configure
make
make install

#NOTICE: Make sure this is the correct php.ini for the box!!

echo 'extension=/usr/local/lib/php/extensions/no-debug-non-zts-20020429/ffmpeg.so' >> /usr/local/Zend/etc/php.ini

#NOTICE: Make sure this is the correct php.ini for the box!!

service httpd restart
cd /usr/local/src

Install FFmpeg and FFmpeg-PHP in Linux

FFmpeg is an amazing collection of open-source tools that can record and stream video and audio. However, it can also transcode video and audio (convert the files to different formats), and that is what has me so excited. There’s also a great PHP package called ffmpeg-php that allows for easy use of FFmpeg from inside PHP scripts. Today, I’m going to see if I can’t help you get both of these set up on your system.

Admittedly, it’s been a while since I’ve tried to install FFmpeg, about two years. I recently thought up some ideas on how I’d like to use FFmpeg, so I thought it was time to give it a try yet again. Today, I’m proud to say that installing FFmpeg is so much easier to install compared to the past, that I dare say it’s simple.

Here is my experience with installing FFmpeg on my server and how to fix the pitfalls that I encountered.
Preface

Note that I did all the following steps on a CentOS server. The specific version is CentOS x64 5.2.

These instructions can work for other distros with little or no modifications, but some distros will be completely different. For example, the DAG RPM Repository that I’m using (more info below) has support for the following distros: Red Hat Enterprise Linux, Fedora Core, Yellow Dog Linux, Aurora Linux, CentOS, Scientific Linux (they really need to get a verified SSL cert), TaoLinux, WhiteBox Linux, Lineox, and BLAG. Other distros will need to use a different repository.

If you successfully get FFmpeg running on another distro, please comment your changes here and I’ll update the post (and make sure you get credit of course).

Also note that I experienced some bumps in the road while installing everything. While many of you may not experience these issues, I found it important to document these problems and how I fixed them in case you encounter them.
Preparing

The first thing that you need to do is set up the DAG repository. This repository is an actively-maintained repository that provides a staggering number of packages with current or near current builds. Adding this repository is a great way to run the latest offerings of many packages.

Adding the DAG repository is simple. I’m using yum, so I did the following to add the repository:

1. Create and open a new file called /etc/yum.repos.d/dag.repo. I ran “vi /etc/yum.repos.d/dag.repo“.
2. Add the following text to the file:
[dag]
name=DAG RPM Repository
baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
gpgcheck=1
enabled=1
3. Finally, save and close the file.

In order to successfully use the DAG repository with tools such as yum, you need to add DAG’s GPG key. Failure to do so will result in an error like the following:
warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID 6b8d79e6
Public key for faac.x86_64.1.26-1.el5.rf.rpm is not installed

In order to add the GPG key for DAG, run the following:
rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt

The DAG: Frequently Asked Questions page has additional instructions on how to get the repository loaded and working on your distro.

Now that DAG is setup, it’s a good idea to update all your packages.
yum update

Depending on the packages you currently have installed, this could potentially upgrade, install, or replace numerous packages that may or may not be very important to you. Make sure you carefully look through that list and do any necessary preparations before telling yum that it can go ahead.

For example, yum told me that it was going to replace my current MySQL interface library for Perl with a new one. I added to my check list a note to verify that my Perl code functioned correctly after the install.

I ran into another hitch when I told yum to go ahead with the update. It informed me that my current version of Subversion conflicted with the new version it wanted to install. When this happens, you need to remove the old package before proceeding. This time, I made backups of all of my repositories and my /etc/sysconfig/svnserve file before proceeding just in case. I then removed Subversion “yum remove subversion“, ran the update process “yum update“, and installed Subversion again “yum install subversion“.
Installing - FFmpeg

Now you are ready to install FFmpeg with yum. I wanted to install all the available FFmpeg packages, so I first asked yum what was available.
yum search ffmpeg

Searching through the results, I found that three packages need to be installed: ffmpeg, ffmpeg-devel, and ffmpeg-libpostproc.
yum install ffmpeg ffmpeg-devel ffmpeg-libpostproc

Note: If you install ffmpeg-libpostproc, the entire FFmpeg software library changes from the LGPL license to the GPL license.

After a couple of minutes, the packages and the packages that they depend on were installed.

I simply ran “ffmpeg” from the command line, and I took the lack of threatening error or warning messages as a good sign that things were working.
Preparing for ffmpeg-php

I often work with programs through command line calls in code, but I wanted something more robust this time, so I looked around and found ffmpeg-php. Based on the API, it looks to be a great tool to interface PHP and FFmpeg.

There are four things that are required to successfully install and run ffmpeg-php; they are:

* ffmpeg-0.4.9_pre1 or higher
* php-4.3.0 or higher
* gd-2.0 or higher
* php-devel

PHP and FFmpeg should be good to go since at the time of this writing, DAG has PHP version 5.1.6 and FFmpeg version 0.4.9. GD and php-devel can be easily installed by running the following yum command:
yum install php-gd php-devel

In case you are wondering what php-devel is for, it installs the phpize program which is used to install ffmpeg-php.
Installing ffmpeg-php

Now we are ready to install ffmpeg-php. This can be done in six easy steps:

1. Download the latest ffmpeg-php release
2. Extract the archive:
tar -xjf ffmpeg-php-X.x.x.tbz2
3. cd ffmpeg-php-X.x.x/
4. phpize
5. ./configure && make
6. sudo make install

Finishing Thoughts

This may seem like a lot of work when I earlier described this process as “simple,” but trust me that this is a thousand times easier than when I first tried installing FFmpeg. I think I spent three hours working on installing FFmpeg just to find out that it didn’t work the first time I tried.

Time and time again, package management has proven to be an extremely powerful tool. While I know the value of manually configuring and compiling code, the ease of simply using a package manager can reduce the time needed to install and manage software from hours or days to minutes.

I’m glad to see that FFmpeg has benefited from the use of these package managers and great repositories like the DAG RPM Repository.

Setup Linux DAG Repository

The first thing that you need to do is set up the DAG repository. This repository is an actively-maintained repository that provides a staggering number of packages with current or near current builds. Adding this repository is a great way to run the latest offerings of many packages.

Adding the DAG repository is simple. I’m using yum, so I did the following to add the repository:

1. Create and open a new file called /etc/yum.repos.d/dag.repo. I ran “vi /etc/yum.repos.d/dag.repo“.
2. Add the following text to the file:
[dag]
name=DAG RPM Repository
baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
gpgcheck=1
enabled=1
3. Finally, save and close the file.

In order to successfully use the DAG repository with tools such as yum, you need to add DAG’s GPG key. Failure to do so will result in an error like the following:
warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID 6b8d79e6
Public key for faac.x86_64.1.26-1.el5.rf.rpm is not installed

In order to add the GPG key for DAG, run the following:
rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt

The DAG: Frequently Asked Questions page has additional instructions on how to get the repository loaded and working on your distro.

Now that DAG is setup, it’s a good idea to update all your packages.
yum update

Depending on the packages you currently have installed, this could potentially upgrade, install, or replace numerous packages that may or may not be very important to you. Make sure you carefully look through that list and do any necessary preparations before telling yum that it can go ahead.

For example, yum told me that it was going to replace my current MySQL interface library for Perl with a new one. I added to my check list a note to verify that my Perl code functioned correctly after the install.

I ran into another hitch when I told yum to go ahead with the update. It informed me that my current version of Subversion conflicted with the new version it wanted to install. When this happens, you need to remove the old package before proceeding. This time, I made backups of all of my repositories and my /etc/sysconfig/svnserve file before proceeding just in case. I then removed Subversion “yum remove subversion“, ran the update process “yum update“, and installed Subversion again “yum install subversion“.

checking for ffmpeg headers… configure: error: ffmpeg headers not found. Make sure you’ve built ffmpeg as shared libs using the –enable-shared option

Took me ages figure this one out. I’d install FFMPEG a number of times previously, no problem. This time round I’m installing it on CENTOS 4, and this error cropped up. After checking I had installed FFMPEG itself with the –enable-shared option the hair pulling and cussing begun. By the way if you want to check you have ffmpeg installed with the shared option do a
ffmpeg -version
The configs should show up. After confirming that you have –enable-shared there, then try the following:

The exact error happens when you phpize the php-ffmpeg file. The error goes something like this:
checking for gawk… gawk
checking for ffmpeg support… yes, shared
checking for ffmpeg headers… configure: error: ffmeg headers not found. Make sure you’ve bult ffmpeg as shared libs using the –enable-shared option

It means basically that the shared files that are requried aren’t in their correct locations. php-ffmpeg is checking /usr/local/include/ffmpeg location and yours are in the /usr/local/include directory. Silly I know, but at least its easily fixed. Run the following commands which copies the files to the new location:


cp /usr/local/include/libavcodec/* /usr/local/include/ffmpeg
cp /usr/local/include/libavutil/* /usr/local/include/ffmpeg
cp /usr/local/include/libavformat/* /usr/local/include/ffmpeg
cp /usr/local/include/libavdevice/* /usr/local/include/ffmpeg
cp /usr/local/include/libswscale/* /usr/local/include/ffmpeg

If you don’t have the libswscale directory don’t loose sleep over it, just ignore it!


checking for ffmpeg headers… configure: error: ffmpeg headers not found. Make sure you’ve built ffmpeg as shared libs using the –enable-shared option

by David Scott on Apr.17, 2008, under ffmpeg

ARGGHGHAHGHGHGHGHGHHG!

Dammit ffmpeg, stop messing with me!

Took me ages figure this one out. I’d install FFMPEG a number of times previously, no problem. This time round I’m installing it on CENTOS 4, and this error cropped up. After checking I had installed FFMPEG itself with the –enable-shared option the hair pulling and cussing begun. By the way if you want to check you have ffmpeg installed with the shared option do a
ffmpeg -version
The configs should show up. After confirming that you have –enable-shared there, then try the following:

The exact error happens when you phpize the php-ffmpeg file. The error goes something like this:
checking for gawk… gawk
checking for ffmpeg support… yes, shared
checking for ffmpeg headers… configure: error: ffmeg headers not found. Make sure you’ve bult ffmpeg as shared libs using the –enable-shared option

It means basically that the shared files that are requried aren’t in their correct locations. php-ffmpeg is checking /usr/local/include/ffmpeg location and yours are in the /usr/local/include directory. Silly I know, but at least its easily fixed. Run the following commands which copies the files to the new location:


cp /usr/local/include/libavcodec/* /usr/local/include/ffmpeg
cp /usr/local/include/libavutil/* /usr/local/include/ffmpeg
cp /usr/local/include/libavformat/* /usr/local/include/ffmpeg
cp /usr/local/include/libavdevice/* /usr/local/include/ffmpeg
cp /usr/local/include/libswscale/* /usr/local/include/ffmpeg

If you don’t have the libswscale directory don’t loose sleep over it, just ignore it!


Now do

make clean

just to be sure. Run the

phpize

command and then try your

./configure

command on php-ffmpeg now.

As a last resort you may need to copy the following files also:
avcodec.h
avformat.h
libio.h

They should all have been copied previously, but just ensure they exist in the /usr/local/include/ffmpeg location.

Maybe just another tiny piece of your hairline saved!!