buy tb500

Archive for the ‘Linux’ Category

Install and configure FFmpeg and FFpeg-Php

Monday, August 23rd, 2010

There are two methods to install FFmpeg and FFmpeg-Php, their libraries, and modules:

  1. Using Yum on systems including Red Hat, CentOS, and Fedora Core.
  2. Manually, from source archives/packages

Method #1: Yum

*** Caution

  • You must remove all previous installation of FFmpeg and FFmpeg-Php, then follow installation instructions below.
  • Follow these steps (in that order):

First, make sure the following binary packages are installed on your server:

gcc, gcc4, gcc4-c++, gcc4-gfortran, gd, gd-devel, gmake, ImageMagick, ImageMagick-devel, libcpp, libgcc, libstdc++, make, ncurses, ncurses-devel, ruby, subversion

If any of these packages are missing, install them using Yum . For example:

  • yum install PACKAGE
  1. Install RPMForge Respository
    • rpm -Uhv ftp://ftp.pbone.net/mirror/dag.wieers.com/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
  2. Install ffmpeg, mplayer, mencoder with all supported libraries/modules
    • yum -y install ffmpeg ffmpeg-devel mplayer mencoder flvtool2
  3. Manually, install FFmpeg-Php
    • cd /usr/local/src
    • wget http://garr.dl.sourceforge.net/sourceforge/ffmpeg-php/ffmpeg-php-0.6.0.tbz2
    • tar jxvf ffmpeg-php-0.6.0.tbz2
    • cd ffmpeg-php-0.6.0
    • phpize
    • ./configure
    • make
    • make install

If FFmpeg-Php is compiled successfully, an ffmpeg.so module will be generated and copied into the default Php directory. Next, run the following command to enable FFmpeg-Php. By running this command you will be adding ffmpeg.so module into the php.ini file:

echo ‘extension=ffmpeg.so’ >> /local_path_to_your/php.ini

Final step, restart apache

service httpd restart
OR
/etc/init.d/httpd restart

– Testing FFmpeg
Verify that FFmpeg is working properly by running the following two commands:

  • php -r ‘phpinfo();’ | grep ffmpeg

You will get a few lines similar to the following:

ffmpeg
ffmpeg-php version => 0.6.0-svn
ffmpeg-php built on => April  15 2010 15:31:45
ffmpeg-php gd support  => enabled
ffmpeg libavcodec version => Lavc51.62.0
ffmpeg libavformat version => Lavf52.18.0
ffmpeg swscaler => disabled
ffmpeg.allow_persistent => 0 => 0
ffmpeg.show_warnings => 0 => 0

This is the second command to make sure that FFmpeg is working properly:

  • /usr/local/bin/ffmpeg

If you do not get any errors after running the test commands above, FFmpeg, FFmpeg-Php, MPlayer, MEncoder, and FLV2tool are working properly on your server. CONGRATULATIONS!

——————————-

Method #2: Source archives/packages

*** Caution

  • You must remove all previous installation of FFmpeg and FFmpeg-Php, then follow installation instructions below.
  • Follow these steps (in that order):

First, make sure the following binary packages are installed on your server:

gcc, gcc4, gcc4-c++, gcc4-gfortran, gd, gd-devel, gmake, ImageMagick, ImageMagick-devel, libcpp, libgcc, libstdc++, make, ncurses, ncurses-devel, ruby, subversion

If any of these packages are missing, install them using Yum . For example:

  • yum install PACKAGE

*** Caution

  • The following source packages are always updated with newer versions. You might experience technical issues if you download and install a newer/older version of any of these applications.
  • You must remove all previous installation of FFmpeg and FFmpeg-Php, then follow installation instructions below.

To install FFmpeg from source, execute the following commands (in that order).

  1. Let’s create a directory to do our work in:
    • mkdir /usr/local/src
    • cd /usr/local/src
  2. Download source packages
    • wget http://liba52.sourceforge.net/files/a52dec-0.7.4.tar.gz
    • wget http://ftp.penguin.cz/pub/users/utx/amr/amrnb-7.0.0.2.tar.bz2
    • wget http://ftp.penguin.cz/pub/users/utx/amr/amrwb-7.0.0.2.tar.bz2
    • wget http://www3.mplayerhq.hu/MPlayer/releases/codecs/essential-ppc-20071007.tar.bz2
    • wget http://downloads.sourceforge.net/project/faac/faac-src/faac-1.28/faac-1.28.tar.bz2
    • wget http://downloads.sourceforge.net/project/faac/faad2-src/faad2-2.7/faad2-2.7.tar.gz
    • wget http://biznetnetworks.dl.sourceforge.net/sourceforge/ffmpeg-php/ffmpeg-php-0.6.0.tbz2
    • 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://downloads.xiph.org/releases/ogg/libogg-1.1.4.tar.gz
    • wget http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.bz2
    • wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.2.2.tar.gz
    • wget http://downloads.sourceforge.net/project/re2c/re2c/0.13.5/re2c-0.13.5.tar.gz
    • wget http://download.m0k.org/handbrake/contrib/xvidcore-1.1.3.tar.gz
    • wget http://downloads.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-20080324-2245.tar.bz2
  3. Extract source packages
    • tar xzf a52dec-0.7.4.tar.gz
    • tar jxvf amrnb-7.0.0.2.tar.bz2
    • tar jxvf amrwb-7.0.0.2.tar.bz2
    • tar jxvf essential-ppc-20071007.tar.bz2
    • tar jxvf faac-1.28.tar.bz2
    • tar xzf faad2-2.7.tar.gz
    • tar jxvf ffmpeg-php-0.6.0.tbz2
    • tar zxvf flvtool2-1.0.6.tgz
    • tar xzf lame-3.98.4.tar.gz
    • tar xzf libogg-1.1.4.tar.gz
    • tar jxvf libtheora-1.1.1.tar.bz2
    • tar xzf libvorbis-1.2.2.tar.gz
    • tar xzf re2c-0.13.5.tar.gz
    • tar xzf xvidcore-1.1.3.tar.gz
    • tar jxvf x264-snapshot-20080324-2245.tar.bz2
  4. Create the codecs directory & export files
    • mkdir /usr/local/lib/codecs
    • mv /usr/local/src/essential-ppc-20071007/* /usr/local/lib/codecs
    • chmod -R 755 /usr/local/lib/codecs
    • echo “/usr/local/lib” >> /etc/ld.so.conf
    • ldconfig
  5. Install SVN and Ruby (for RedHat/CentOS v5.x)
    • yum install subversion
    • yum install ruby
      OR (if you are using the cPanel control panel )

      • /scripts/installruby
      • /usr/local/cpanel/bin/ror_setup
    • yum install ncurses-devel
  6. Compile and install FLVtool2
    • cd /usr/local/src/flvtool2-1.0.6/
    • ruby setup.rb config
    • ruby setup.rb setup
    • ruby setup.rb install
  7. Compile and install LAME
    • cd /usr/local/src/lame-3.98.4
    • ./configure
    • make
    • make install
  8. Compile and install libOGG
    • cd /usr/local/src/libogg-1.1.4
    • ./configure
    • make
    • make install
    • PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
    • export PKG_CONFIG_PATH
  9. Compile and install LibVorbis
    • cd /usr/local/src/libvorbis-1.2.2
    • ./configure
    • make
    • make install
  10. Compile and install Libtheora
    • cd /usr/local/src/libtheora-1.1.1
    • ./configure –with-ogg-libraries=/usr/local/lib/
    • make
    • make install
  11. Compile and install amrNB
    • cd /usr/local/src/amrnb-7.0.0.2
    • ./configure
    • make
    • make install
  12. Compile and install amrWB
    • cd /usr/local/src/amrwb-7.0.0.2
    • ./configure
    • make
    • make install
  13. Compile and install Liba52
    • cd /usr/local/src/a52dec-0.7.4
    • ./bootstrap
    • ARCh=’arch’
    • ./configure –enable-shared
    • make
    • make install
  14. Compile and install FAAC
    • cd /usr/local/src/faac-1.28
    • ./bootstrap
    • ./configure –with-mp4v2
    • make
    • make install
  15. Compile and install FAAD
    • cd /usr/local/src/faad2-2.7
    • ./configure –with-mpeg4ip
    • make
    • make install
  16. Compile and install XVIDCore
    • cd /usr/local/src/xvidcore/build/generic/
    • ./configure
    • make
    • make install
  17. Compile and Install X264 Snapshot
    • cd /usr/local/src/x264-snapshot-20080324-2245
    • ./configure –enable-shared
    • make
    • make install
  18. Compile and install RE2C
    • cd /usr/local/src/re2c-0.13.5
    • ./configure
    • make
    • make install
    • cp -aP /usr/local/bin/re2c /usr/bin/
  19. Download the latest release for FFmpeg and MPlayer from svn.mplayerhq.hu
    • cd /usr/local/src
    • svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg -r 15594
    • svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer
    • svn update
  20. Compile and install MPlayer
    • cd /usr/local/src/mplayer
    • ./configure
    • make

    (STOP here.) Make sure MPlayer has been compiled successfully with NO errors. Do NOT proceed any further unless the MPlayer package has been compiled successfully.

    • make install
  21. Compile and install FFmpeg
    • cd /usr/local/src/ffmpeg/
    • mkdir /usr/local/src/ffmpeg/tmp
    • export TMPDIR=/usr/local/src/ffmpeg/tmp

    (The following ./configure command is one single line)

    • ./configure –enable-shared –enable-nonfree –enable-gpl –enable-pthreads –enable-liba52 –enable-libamr-nb –enable-libamr-wb –enable-libfaac –enable-libfaad –enable-libmp3lame –enable-libtheora –enable-libvorbis –enable-libx264 –enable-libxvid –enable-cross-compile
    • make

    (STOP here.) Make sure FFmpeg has been compiled successfully with NO errors. Do NOT proceed any further unless the FFmpeg package has been compiled successfully.

    • make install
    • export LD_LIBRARY_PATH=/usr/local/lib/
  22. Finalize the codec setups:
    (Create symbolic links for the following modules. FYI: the number which comes after the extension *.so might differ from one server to another. The X‘s represent numbers. The number after *.so.5 must match the number after the *.so.5 at the end of the line.)

    • ln -s /usr/local/lib/libavformat.so.5X.XX.0 /usr/lib/libavformat.so.5X
    • ln -s /usr/local/lib/libavcodec.so.5X.XX.0 /usr/lib/libavcodec.so.5X
    • ln -s /usr/local/lib/libavutil.so.49.X.0 /usr/lib/libavutil.so.49
    • ln -s /usr/local/lib/libmp3lame.so.0 /usr/lib/libmp3lame.so.0
    • /sbin/ldconfig
  23. Compile and install FFmpeg-Php
    • cd /usr/local/src/ffmpeg-php-0.6.0/
    • /usr/bin/phpize
    • ./configure
    • make

    (STOP here.) Make sure FFmpeg-Php has been compiled successfully with NO errors. Do NOT proceed any further unless the FFmpeg-Php package has been compiled successfully.

    • make install
      Verify that ffmpeg-php module is saved in the Php extensions directory by running:
    • ls -al /usr/local/lib/php/extensions/no-debug-non-zts-20060613/ffmpeg.so
  24. Add FFmpeg-Php module directive in php.ini file: (make sure the local path to your php.ini is correct.)
    • echo ‘extension=ffmpeg.so’ >> /usr/local/lib/php.ini
  25. Restart Apache to load FFmpeg-Php (for RedHat/CentOS v5.x)
    • service httpd restart

– Testing FFmpeg
Verify that FFmpeg is working properly by running the following two commands:

  • php -r ‘phpinfo();’ | grep ffmpeg

You will get a few lines similar to the following:

ffmpeg
ffmpeg-php version => 0.6.0-svn
ffmpeg-php built on => April  15 2010 15:31:45
ffmpeg-php gd support  => enabled
ffmpeg libavcodec version => Lavc51.62.0
ffmpeg libavformat version => Lavf52.18.0
ffmpeg swscaler => disabled
ffmpeg.allow_persistent => 0 => 0
ffmpeg.show_warnings => 0 => 0

This is the second command to make sure that FFmpeg is working properly:

  • /usr/local/bin/ffmpeg

If you do not get any errors after running the test commands above, FFmpeg, FFmpeg-Php, MPlayer, MEncoder, FLV2tool, LAME MP3 encoder & libOGG are working properly. CONGRATULATIONS!

References

http://servertune.com/kbase/entry/133/

XOOPS path check: Script is not inside XOOPS_ROOT_PATH and cannot run.

Thursday, August 19th, 2010

to fix the problem , go to the xoops directory then find mainfile.php and edit it as below

change this vale define(‘XOOPS_CHECK_PATH’, ‘1’); to define(‘XOOPS_CHECK_PATH’, ‘o’);

then sure will be fixed,, i have tried this and fixed my issue prevously

Thank you.

webmail in cpanel server showing internal server error

Tuesday, July 20th, 2010

Solution

need to change the permission for perl from 700 to 755

/usr/bin/perl

Thank you.

check ip blacklist or whitelist in firewall or iptables

Monday, July 19th, 2010

iptables -L -n –line | grep 61.153.249.242

if black list then you will see like that

DROP       all  —  61.153.249.242

whitelist like below

ACCEPT     all  —  61.153.249.242

Thank you.

Image can not show in the website

Monday, July 19th, 2010

You need to go to WHM then disable mod_security for that domain or addon domain, then you will be able to access the website and show all the images

Thank you.

addon domain and park domain below to who?

Monday, July 19th, 2010

/scripts/whoowns  parkdomain or addondomain

for ex.

maindomain is alzwea.com  user for the main domain is alzweac , addon domain is ayad.com

/scripts/whoowns ayad.com

the result is alzweac

Thank you.

Checking if IP is blocked from Iptables

Sunday, July 18th, 2010

How to check if IP is blocked from IptablesCheck if IP is blocked:
# iptables -L -n –line | grep [IP Address]

If IP appear as DROP or REJECT, the IP has been blocked

Unblock the IP Address:
# iptables -I INPUT -s [IP Address] -j ACCEPT

Blocking back an IP Address:
# iptables -A INPUT -d [IP Address] -j DROP

Note: Full path to IPTABLES is /sbin/iptables, you can replace command # iptables with /sbin/iptables

References

http://support.hivehost.net/index.php?_m=knowledgebase&_a=viewarticle&kbarticleid=6

permission re-configure in for domain in cpanel server

Tuesday, July 6th, 2010

you need to ssh to the server then go to domain directory for example

cd /home/alzweac then run below command

/scripts/upcp –force

Thanks

redirect port 26 to port 25 in linux

Saturday, June 26th, 2010

iptables -t nat -A PREROUTING -p tcp –dport 26 -j REDIRECT –to-ports 25

so that mean if the server using port 25 for SMTP , and your ISP block port 25, then run this command and use port 26 then automaticlly will change to port 25 once reach the server

Thank you.


How to enable port 587 (submission) in postfix mail server

Saturday, June 26th, 2010

To enable port 587, edit the file /etc/postfix/master.cf

vi /etc/postfix/master.cf

and remove the # in front of the line:

#submission inet n      –       n       –       –       smtpd
so that it looks like this:

submission inet n      –       n       –       –       smtpd

and restart postfix:

/etc/init.d/postfix restart