Archive for September, 2010

Manually Rotate Logs with logrotate

September 8th, 2010

The individual configuration files for logrotate are located in /etc/logrotate.d:

# cd /etc/logrotate.d/

Then, to manually rotate the logs for exim, simply run the following.

# logrotate exim

Note: you won’t see any output, but you will notice that the exim logs in /var/log are now rotated out.

Share

How to Uninstall Servlets from a cPanel Account

September 7th, 2010

You can remove Tomcat support for sites via /scripts/remservlets, which uses the following syntax:

/scripts/remservlets --domain=domain-you-want-to-remove-jsp-and-servlets.com
Share

How to Install ffmpeg

September 1st, 2010

This post will provide you with the instructions to download and install ffmpeg, ffmpeg-php, flvtool, lame, mplayer, libogg, libvorbis, mencoder, and other codecs used with ffmpeg.

# cd /usr/local/src
wget http://rubyforge.org/frs/download.php/17497/flvtool2-1.0.6.tgz
wget http://downloads.sourceforge.net/project/lame/lame/3.98.4/lame-3.98.4.tar.gz
wget http://www.mplayerhq.hu/MPlayer/releases/mplayer-export-snapshot.tar.bz2
wget http://downloads.sourceforge.net/project/ffmpeg-php/ffmpeg-php/0.6.0/ffmpeg-php-0.6.0.tbz2
wget http://downloads.xiph.org/releases/ogg/libogg-1.2.0.tar.gz
wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.1.tar.gz
wget http://www.mplayerhq.hu/MPlayer/releases/codecs/essential-20071007.tar.bz2
wget http://ffmpeg.org/releases/ffmpeg-0.6.tar.gz
tar xvzf flvtool2-1.0.6.tgz
tar xvzf lame-3.98.4.tar.gz
tar jxvf ffmpeg-php-0.6.0.tbz2
tar xvzf libogg-1.2.0.tar.gz
tar xvzf libvorbis-1.3.1.tar.gz
tar jxvf essential-20071007.tar.bz2
tar jxvf mplayer-export-snapshot.tar.bz2
tar xvzf ffmpeg-0.6.tar.gz 

Make a directory to store all the codecs:

# mkdir /usr/local/lib/codecs/

Install any necessary packages:

yum install gcc gmake make libcpp libgcc libstdc++ gcc4 gcc4-c++  ncurses-devel

Copy codecs for mplayer:

mv /usr/local/src/essential-20071007/* /usr/local/lib/codecs/
chmod -R 755 /usr/local/lib/codecs/

Installing Lame:

cd /usr/local/src/lame-3.98.4
./configure
make && make install

Installing Libogg:

cd /usr/local/src/libogg*
./configure && make && make install
Installing libvorbis:
cd /usr/local/src/libvorbis*
./configure && make && make install

Installing flvtool2:

cd /usr/local/src/flvtool*
ruby setup.rb config
ruby setup.rb setup
ruby setup.rb install
# cd /usr/local/src/mplayer*
./configure && make && make install

Installing ffmpeg PHP module

cd /usr/local/src/ffmpeg-*
./configure --enable-libmp3lame --enable-libvorbis --disable-mmx --enable-shared

(If you need to customize your install, run “./configure –help” to see a complete list of the available flags)

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

Installing ffmpeg-php:

# cd /usr/local/src/ffmpeg-php*
phpize
./configure

There’s a small issue in this version of ffmpeg-php which, when “make” is run, will cause the following error:

 gcc -I. -I/usr/local/src/ffmpeg-php-0.6.0 -DPHP_ATOM_INC -I/usr/local/src/ffmpeg-php-0.6.0/include -I/usr/local/src/ffmpeg-php-0.6.0/main -I/usr/local/src/ffmpeg-php-0.6.0 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/local/include/libavcodec/ -I/usr/local/include/libavformat/ -I/usr/local/include/libavutil/ -I/usr/local/include/libswscale/ -I/usr/local/include/libavfilter/ -I/usr/local/include/libavdevice/ -I/usr/include/php -DHAVE_CONFIG_H -g -O2 -Wall -fno-strict-aliasing -c /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_frame.c  -fPIC -DPIC -o .libs/ffmpeg_frame.o
/usr/local/src/ffmpeg-php-0.6.0/ffmpeg_frame.c: In function 'zim_ffmpeg_frame_toGDImage':
/usr/local/src/ffmpeg-php-0.6.0/ffmpeg_frame.c:336: error: 'PIX_FMT_RGBA32' undeclared (first use in this function)
/usr/local/src/ffmpeg-php-0.6.0/ffmpeg_frame.c:336: error: (Each undeclared identifier is reported only once
/usr/local/src/ffmpeg-php-0.6.0/ffmpeg_frame.c:336: error: for each function it appears in.)
/usr/local/src/ffmpeg-php-0.6.0/ffmpeg_frame.c: In function 'zim_ffmpeg_frame_ffmpeg_frame':
/usr/local/src/ffmpeg-php-0.6.0/ffmpeg_frame.c:421: error: 'PIX_FMT_RGBA32' undeclared (first use in this function)
make: *** [ffmpeg_frame.lo] Error 1

To correct this issue, we’ll update ffmpeg_frame.c and replace every instance of PIX_FMT_RGBA32 with PIX_FMT_RGB32

vi ffmpeg_frame.c
:%s/PIX_FMT_RGBA32/PIX_FMT_RGB32

:w :q!

Now we can proceed with compiling:

make
make install

Now that we’ve compiled, let’s make sure that ffmpeg.so is in the proper extensions directory:

php -i | grep extensions
/usr/local/lib/php/extensions/no-debug-non-zts-20060613

Now we’ll tell PHP that it needs to load our module:

 echo 'extension=ffmpeg.so' >> /usr/local/lib/php.ini

Restart apache:

service httpd restart

Now we’ll do a quick list of the modules to ensure that ffmpeg-php is loaded:

php -m | grep ffmpeg
ffmpeg

All done!

Share

cPanel Web Site Hosting by IntraHost