Wednesday, July 17, 2013

// // Leave a Comment

Split a Media Video File (AVI, FLV,...) using Mencoder and Mplayer

Mencoder is a movie encoder program that allows us to split a media video(e.g AVI) file into several AVI files.

We are going to split a media video file maintaining same video and audio codecs.

As mencoder accepts other file formats than avi files, we will be able to split them too, but result will be avi files.

SPLIT ONE FILE INTO TWO


E.g: We are going to split foo.avi file into foo1.avi(600 seconds long) and remaining length in foo2.avi.

Following mencoder man page advice, we could try these options:
$ mencoder foo.avi -o foo1.avi -oac copy -ovc copy -endpos 600
$ mencoder foo.avi -o foo3.avi -oac copy -ovc copy -ss 600


mencoder options:

foo.avi is the input file

-o foo1.avi indicates the output file

-oac copy means use same audio codec
-ovc copy means use same video codec

-endpos <[[hh:]mm:]ss[.ms]|size[b|kb|mb]>
Stop at given time or byte position.

Examples:
-endpos 56 # Stop at 56 seconds.
-endpos 01:10:00 # Stop at 1 hour 10 minutes.
-ss 10 -endpos 56 # Stop at 1 minute 6 seconds.
$ mplayer -endpos 100mb # Stop playback after reading 100MB of the input file.
$ mencoder -endpos 100mb # Encode only 100 MB.

So -endpos 600 indicates encode first 600 seconds of video stream.


-ss
Seek to given time position.

Examples:
-ss 56 # Seeks to 56 seconds.
-ss 01:10:00 # Seeks to 1 hour 10 min.


We could use frames instead of time or size:
-frames
Play/:convert only first frames, then quit.


SPLIT ONE FILE INTO THREE OR MORE


If we want to split the file into more than two files, we use -ss along -endpos.

E.g: Split foo.avi into foo1.avi(300 seconds in length), foo2.avi(100 seconds) and remaining in foo3.avi
$ mencoder foo.avi -o foo1.avi -oac copy -ovc copy -endpos 300
$ mencoder foo.avi -o foo2.avi -oac copy -ovc copy -ss 300 -endpos 100
$ mencoder foo.avi -o foo3.avi -oac copy -ovc copy -ss 400


SPLIT INTO TWO PARTS BASED ON SIZE AND GET I-FRAMES RIGHT.


E.g: We want to split an avi file into two parts, one part 300MByte in size.

Run mplayer to know where I-frames are located:
$ mplayer -framedrop -endpos 300mb -vf framestep=I foo.avi

We advance it until near the end and get:
I!
A:2360.0 V:2360.0 A-V: 0.000 ct: 0.042 59000/59000 3% 0% 0.8% 0 0
I!
A:2362.8 V:2362.8 A-V: 0.000 ct: 0.042 59072/59072 3% 0% 0.8% 0 0

IMPORTANT: I-frame data comes before I!.
So last I-frame comes at 2360.0 seconds.
We will use video time in seconds of last I-frame: 2360.0

$ mencoder foo.avi -o foo1.avi -endpos 2360.0 -ovc copy -oac copy
$ mencoder foo.avi -o foo2.avi -ss 2360.0 -ovc copy -oac copy


NOTE:
Sometimes I get this error when encoding a video file:
1 duplicate frame(s)!
Changing audio codec solved this problem: -oac mp3lame
(Note that this changes media file size)
http://darkmind2007.blogspot.com/2011/04/mencoder-1-duplicate-frames.html
Read More

Thursday, May 23, 2013

// // 5 comments

How to take multiple screenshots to an image (tile, mosaic)


To make multiple screenshots and place them into a single image file (creating tiles), you can use FFmpeg's tile video filter, like this:
ffmpeg -ss 00:00:10 -i movie.avi -frames 1 -vf 'select=not(mod(n\,1000)),scale=320:240,tile=2x3' out.png
That will seek 10 seconds into the movie, select every 1000th frame, scale it to 320x240 pixels and create 2x3 tiles in the output image out.png, which will look like this:


Read More

Friday, April 19, 2013

// // 1 comment

HowTo Use rsync For Transferring Files Under Linux or UNIX


How do you install and use rsync to synchronize files and directories from one location (or one server) to another location? - A common question asked by new sys admin.

rsync is a free software computer program for Unix and Linux like systems which synchronizes files and directories from one location to another while minimizing data transfer using delta encoding when appropriate. An important feature of rsync not found in most similar programs/protocols is that the mirroring takes place with only one transmission in each direction.

So what is unique about the rsync command?

It can perform differential uploads and downloads (synchronization) of files across the network, transferring only data that has changed. The rsync remote-update protocol allows rsync to transfer just the differences between two sets of files across the network connection.

How do I install rsync?

Use any one of the following commands to install rsync. If you are using Debian or Ubuntu Linux, type the following command:
# apt-get install rsync
OR
$ sudo apt-get install rsync
If you are using Red Hat Enterprise Linux (RHEL) / CentOS 4.x or older version, type the following command:
# up2date rsync
RHEL / CentOS 5.x or newer (or Fedora Linux) user type the following command:
# yum install rsync

Always use rsync over ssh

Since rsync does not provide any security while transferring data it is recommended that you use rsync over ssh session. This allows a secure remote connection. Now let us see some examples of rsync command.

Comman rsync command options

  • --delete : delete files that don't exist on sender (system)
  • -v : Verbose (try -vv for more detailed information)
  • -e "ssh options" : specify the ssh as remote shell
  • -a : archive mode
  • -r : recurse into directories
  • -z : compress file data

Task : Copy file from a local computer to a remote server

Copy file from /www/backup.tar.gz to a remote server called openbsd.nixcraft.in
$ rsync -v -e ssh /www/backup.tar.gz jerry@openbsd.nixcraft.in:~
Output:
Password:
sent 19099 bytes  received 36 bytes  1093.43 bytes/sec
total size is 19014  speedup is 0.99
Please note that symbol ~ indicate the users home directory (/home/jerry).

Task : Copy file from a remote server to a local computer

Copy file /home/jerry/webroot.txt from a remote server openbsd.nixcraft.in to a local computer's /tmp directory:
$ rsync -v -e ssh jerry@openbsd.nixcraft.in:~/webroot.txt /tmp

Task: Synchronize a local directory with a remote directory

$ rsync -r -a -v -e "ssh -l jerry" --delete /local/webroot openbsd.nixcraft.in:/webroot

Task: Synchronize a remote directory with a local directory

$ rsync -r -a -v -e "ssh -l jerry" --delete openbsd.nixcraft.in:/webroot/ /local/webroot

Task: Synchronize a local directory with a remote rsync server or vise-versa

$ rsync -r -a -v --delete rsync://rsync.nixcraft.in/cvs /home/cvs
OR
$ rsync -r -a -v --delete /home/cvs rsync://rsync.nixcraft.in/cvs

Task: Mirror a directory between my "old" and "new" web server/ftp

You can mirror a directory between my "old" (my.old.server.com) and "new" web server with the command (assuming that ssh keys are set for password less authentication)
$ rsync -zavrR --delete --links --rsh="ssh -l vivek" my.old.server.com:/home/lighttpd /home/lighttpd


Read More
// // Leave a Comment

File transfer in background using SCP

For scping large files, it is best to let them run in the background.

follow the steps below to transfer files using SCP command in the background

1) execute the normal scp command, eg:
# scp localfile.tar.bz2 user@server.ch:/path/on/server/

2) after confirming the key and authentificating (if necessary), you can "stop" the job by pressing : ctrl + Z
[1]+ Stopped scp localfile.tar.bz2 user@server.ch:/path/on/server/

3) then you can proceed the job in the background by typing
# bg
[1]+ scp localfile.tar.bz2 user@server.ch:/path/on/server/ &


4) finally, to make sure the process is working in background, issue the “jobs” command
# jobs
[1]+ Running scp localfile.tar.bz2 user@server.ch:/path/on/server/ &


Now the session can be exited with the file transfer unaffected.
Read More

Thursday, November 29, 2012

// // Leave a Comment

How To Install Kloxo Free Control Panel - Step Wise Tutorial.


Kloxo Installation Guide

Prerequisites

1) A dedicated or virtual server running CentOS or Red Hat EL 5.x. CentOS 6.x is not currently supported.
2) At least 256 MB of RAM (enough to run Yum).
3) At least 2 GB of free disk space for Kloxo and related services.
4) If you partitioned your disks manually, make sure you have a large /tmp. Kloxo uses /tmp to create and store backups temporarily and the process will fail if there is not enough space.

Before we begin...

You have to disable SELinux by editing /etc/sysconfig/selinux and changing the line to selinux=disabled. This will keep SELinux from being enabled on your server next boot.

Then you must run the following command as root to disable SELinux for the current session:

# su - root
# setenforce 0


If you are unsure this procedure worked, you can run /usr/sbin/sestatus to check its status. Failure to correctly disable SELinux will render your Kloxo install useless and an OS reload may be required to properly reinstall it.
Also, make sure the ports 7778/tcp and 7777/tcp are open in your server firewall or you won't be able to connect to Kloxo web panel when the install completes.

Installing Kloxo

Kloxo installation consists of downloading kloxo-installer.sh from download.lxcenter.org and executing it as root. The script will present you with a few questions and sometimes ask for a password (enter your root password).

If you don't have MySQL server already installed, you must run:

# su - root
# yum install -y wget
# wget http://download.lxcenter.org/download/kloxo/production/kloxo-installer.sh

To install as Master (Default Single Server):
# sh ./kloxo-installer.sh --type=master

To install as Slave:
# sh ./kloxo-installer.sh --type=slave


If you already have MySQL installed and set a root password, you must run:

# su - root
# yum install -y wget
# wget http://download.lxcenter.org/download/kloxo/production/kloxo-installer.sh
# sh ./kloxo-installer.sh --type= --db-rootpassword=PASSWORD


Once kloxo is installed, you can connect to http://YOUR_SERVER_IP:7778 and you will be presented with a login screen. Login as admin with password admin and once you are in, Kloxo will ask you to change the default password to a secure one.
Read More
// // Leave a Comment

How to Restore a Full Cpmove File Using Whm.

Restoring a full cpmove file or cpanel complete backup file is very easy using the whm interface. The only condition is that the cpmove file or the cpanel backup file should be in any of the below directory:

/home
/usr/home
/web
/home2
/home3
/root
/usr

So if you have the backup file at any other location then please move it to any of the above location otherwise you will not be able to restore the cpanel account using WHM.

Open the whm >> backup >> restore a cpmove file option.

Then you will be able to see the cpmove file available to restore.
Just put the username of the cpanel account that you can see in the backup file name too and its done !

Thats it !

Note: The username must match the name in cpmove file. you may see a list of cpmove files with different names, so only put the name which you want to restore.
Cool
Read More
// // Leave a Comment

How to Create a Backup using SSH Shell Commands.

How to make a backup using command prompt ? How to pack a user account using SSH putty ?
These similar questions are very common among newbies and new webmasters.
Here below is the code that you can use to pack a CPanel account.

1). Open SSH Command prompt window and login as root with your root password.
2). Run the below code and press enter.
Code:
/scripts/pkgacct username
Where username will be the username of the account you want to generate a backup for.
3). Your backup file will be available in /home/ directory fo your server.

CHEERS !
Read More

Saturday, September 15, 2012

// // Leave a Comment

How to copy files using SSH

you can't copy using the 'ssh' program specifically, but you can with it's associated programs: sftp or scp

sftp is (and works) similar to ftp

scp is a neat little program:


copy from a remote machine to my machine:
scp user@192.168.1.100:/home/remote_user/Desktop/file.txt /home/me/Desktop/file.txt

copy from my machine to a remote machine:
scp /home/me/Desktop/file.txt user@192.168.1.100:/home/remote_user/Desktop/file.txt

copy all file*.txt from a remote machine to my machine (file01.txt, file02.txt, etc.; note the quotation marks:
scp "user@192.168.1.100:/home/remote_user/Desktop/file*.txt" /home/me/Desktop/file.txt

copy a directory from a remote machien to my machine:
scp -r user@192.168.1.100:/home/remote_user/Desktop/files /home/me/Desktop/.



see 'man scp' or 'man sftp' for more ... 

hopefully there are no typos! :)
Read More

Thursday, May 10, 2012

// // Leave a Comment

Protect DDOS attack with medialayer (D)DoS Deflate

About

(D)DoS Deflate is a lightweight bash shell script designed to assist in the process of blocking a denial of service attack. It utilizes the command below to create a list of IP addresses connected to the server, along with their total number of connections. It is one of the simplest and easiest to install solutions at the software level.
netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n
IP addresses with over a pre-configured number of connections are automatically blocked in the server's firewall, which can be direct iptables or Advanced Policy Firewall (APF). (We highly recommend that you use APF on your server in general, but deflate will work without it.)

Notable Features

  • It is possible to whitelist IP addresses, via /usr/local/ddos/ignore.ip.list.
  • Simple configuration file: /usr/local/ddos/ddos.conf
  • IP addresses are automatically unblocked after a preconfigured time limit (default: 600 seconds)
  • The script can run at a chosen frequency via the configuration file (default: 1 minute)
  • You can receive email alerts when IP addresses are blocked.

Installation

wget http://www.inetbase.com/scripts/ddos/install.sh
chmod 0700 install.sh
./install.sh

Uninstallation

wget http://www.inetbase.com/scripts/ddos/uninstall.ddos
chmod 0700 uninstall.ddos
./uninstall.ddos
Read More

Saturday, April 14, 2012

// // Leave a Comment

LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5


Install dependensi PHP, modul, and tools
Source codecode LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 printer LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 info LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 
#yum -y install gcc gcc-c++ glibc make automake GeoIP GeoIP-devel GeoIP-data fontconfig fontconfig-devel gd gd-devel pam pam-devel openldap openldap-devel libXpm libXpm-devel libtool libaio libaio-devel libtool-ltdl libtool-ltdl-devel libmcrypt libmcrypt-devel mhash mhash-devel unixODBC unixODBC-devel zip unzip nano perl openssl openssl-devel pcre pcre-devel bzip2 bzip2-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel gmp gmp-devel aspell aspell-devel
Source codecode LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 printer LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 info LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 
#yum -y update
Source codecode LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 printer LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 info LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 
#yum -y install gnupg curl curl-devel libidn libidn-devel libc-client libc-client-devel.`uname -i` libxslt tidy libtidy libtidy-devel
Source codecode LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 printer LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 info LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 
#yum -y install libxml2-devel
Install MySQL 5.5.10
Source codecode LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 printer LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 info LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 
#wget http://www.mirrorservice.org/sites/ftp.mysql.com/Downloads/MySQL-5.5/MySQL-shared-compat-5.5.10-1.linux2.6.`uname -i`.rpm
#wget http://www.mirrorservice.org/sites/ftp.mysql.com/Downloads/MySQL-5.5/MySQL-shared-5.5.10-1.linux2.6.`uname -i`.rpm
#wget http://www.mirrorservice.org/sites/ftp.mysql.com/Downloads/MySQL-5.5/MySQL-devel-5.5.10-1.linux2.6.`uname -i`.rpm
#wget http://www.mirrorservice.org/sites/ftp.mysql.com/Downloads/MySQL-5.5/MySQL-embedded-5.5.10-1.linux2.6.`uname -i`.rpm
#wget http://www.mirrorservice.org/sites/ftp.mysql.com/Downloads/MySQL-5.5/MySQL-server-5.5.10-1.linux2.6.`uname -i`.rpm
#wget http://www.mirrorservice.org/sites/ftp.mysql.com/Downloads/MySQL-5.5/MySQL-client-5.5.10-1.linux2.6.`uname -i`.rpm
Source codecode LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 printer LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 info LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 
#rpm -Uvh http://www.mirrorservice.org/sites/ftp.mysql.com/Downloads/MySQL-5.5/MySQL-shared-compat-5.5.10-1.linux2.6.`uname -i`.rpm
#rpm -Uvh http://www.mirrorservice.org/sites/ftp.mysql.com/Downloads/MySQL-5.5/MySQL-shared-5.5.10-1.linux2.6.`uname -i`.rpm
#rpm -Uvh http://www.mirrorservice.org/sites/ftp.mysql.com/Downloads/MySQL-5.5/MySQL-devel-5.5.10-1.linux2.6.`uname -i`.rpm
#rpm -Uvh http://www.mirrorservice.org/sites/ftp.mysql.com/Downloads/MySQL-5.5/MySQL-embedded-5.5.10-1.linux2.6.`uname -i`.rpm
#rpm -Uvh http://www.mirrorservice.org/sites/ftp.mysql.com/Downloads/MySQL-5.5/MySQL-server-5.5.10-1.linux2.6.`uname -i`.rpm
#rpm -Uvh http://www.mirrorservice.org/sites/ftp.mysql.com/Downloads/MySQL-5.5/MySQL-client-5.5.10-1.linux2.6.`uname -i`.rpm
MySQL configuration
There are 5 default MySQL configuration:
Source codecode LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 printer LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 info LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 
my-innodb-heavy-4G.cnf
my-huge.cnf
my-large.cnf
my-medium.cnf
my-small.cnf
move to “/etc/” directory and rename it to “my.cnf”
Source codecode LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 printer LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 info LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 
#cp /usr/share/mysql/my-small.cnf /etc/my.cnf
to save memory can by using MyISAM engine rather than InnoDB.
Source codecode LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 printer LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 info LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 
#nano /etc/my.cnf

add the following lines to “[mysqld]” section
Source codecode LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 printer LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 info LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 
default-storage-engine=MyISAM
skip-innodb
Start MySQL, create system tables, and securing.
Source codecode LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 printer LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 info LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 
#/etc/init.d/mysql start
#/usr/bin/mysql_install_db
#mysql_secure_installation
#/etc/init.d/mysql stop
#chkconfig --add mysql
#chkconfig mysql on
Install LiteSpeed
Source codecode LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 printer LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 info LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 
#wget http://www.litespeedtech.com/packages/4.0/lsws-4.1-std-i386-linux.tar.gz
#tar -zxvf lsws-4.1-std-i386-linux.tar.gz
#cd lsws-4.1
#chmod +x install.sh
#./install.sh
Do you agree with above license: Yes
Destination: /usr/local/lsws (standart LiteSpeed directory)
Username: your preferred username for administration panel
Password: your preferred password for administration panel
Email addresses: your email address
User: nobody
Group: nobody
HTTP port: 80
Admin HTTP port: choose any port above 2000
Setup PHP: Y
Suffix for PHP script: php
Install AWStats Add-on modul: N
LiteSpeed restart automatically when server restarts: Y
Would you like to start it now: Y
Compiling PHP 5.3.5 
Login to your LiteSpeed administration panel
Open: http://yourip:youradminport
Go to Action – Compile PHP, select PHP 5.3.5 and push next button
Extra PATH environment: Leave this empty
Install Path Prefix: /usr/local/lsws/lsphp5
Configure Parameters 32bit OS:
Source codecode LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 printer LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 info LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 
--prefix=/lsphp5 --with-litespeed --enable-cli --with-mcrypt --enable-mbstring --with-openssl --with-mysql=/usr/bin --with-mysqli --with-mysql-sock=/var/lib/mysql/mysql.sock --with-pdo-mysql --with-gd --with-zlib --with-jpeg-dir=/usr/lib --with-png-dir=/usr/lib --with-png --with-jpeg --with-gmp --with-sqlite --enable-pdo --with-libdir=lib --with-xpm-dir=/usr/lib --with-freetype-dir=/usr/include/freetype2 --with-ttf=/usr/include/freetype2 --libdir=/usr/lib --enable-gd-native-ttf --enable-fileinfo --disable-debug --with-pic --with-bz2 --with-curl --with-curlwrappers --without-gdbm --with-gettext --with-iconv --with-pspell --with-pcre-regex --with-imap --with-imap-ssl=/usr/lib --enable-exif --enable-ftp --enable-magic-quotes --enable-sockets --disable-sysvsem --disable-sysvshm --disable-sysvmsg --enable-track-vars --enable-trans-sid --enable-yp --enable-wddx --with-kerberos --enable-ucd-snmp-hack --enable-memory-limit --enable-shmop --enable-calendar --enable-dbx --enable-dio --with-mime-magic --with-system-tzdata --with-odbc --enable-gd-jis-conv --enable-dom --disable-dba --enable-xmlreader --enable-xmlwriter --with-tidy  --with-xml --with-xmlrpc --with-xsl --enable-bcmath --enable-soap --enable-zip --enable-inline-optimization --with-mhash --enable-mbregex
Configure Parameters 64bit OS:
Source codecode LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 printer LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 info LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 
--prefix=/lsphp5 --with-litespeed --enable-cli --with-mcrypt --enable-mbstring --with-openssl --with-mysql=/usr/bin --with-mysqli --with-mysql-sock=/var/lib/mysql/mysql.sock --with-pdo-mysql --with-gd --with-zlib --with-jpeg-dir=/usr/lib64 --with-png-dir=/usr/lib64 --with-png --with-jpeg --with-gmp --with-sqlite --enable-pdo --with-libdir=lib64 --with-xpm-dir=/usr/lib64 --with-freetype-dir=/usr/include/freetype2 --with-ttf=/usr/include/freetype2 --libdir=/usr/lib64 --enable-gd-native-ttf --enable-fileinfo --disable-debug --with-pic --with-bz2 --with-curl --with-curlwrappers --without-gdbm --with-gettext --with-iconv --with-pspell --with-pcre-regex --with-imap --with-imap-ssl=/usr/lib64 --enable-exif --enable-ftp --enable-magic-quotes --enable-sockets --disable-sysvsem --disable-sysvshm --disable-sysvmsg --enable-track-vars --enable-trans-sid --enable-yp --enable-wddx --with-kerberos --enable-ucd-snmp-hack --enable-memory-limit --enable-shmop --enable-calendar --enable-dbx --enable-dio --with-mime-magic --with-system-tzdata --with-odbc --enable-gd-jis-conv --enable-dom --disable-dba --enable-xmlreader --enable-xmlwriter --with-tidy  --with-xml --with-xmlrpc --with-xsl --enable-bcmath --enable-soap --enable-zip --enable-inline-optimization --with-mhash --enable-mbregex
Add-on Modules: eAccelerator
and then click build php and wait until configuration process done.
Click next and run this command on ssh root
Source codecode LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 printer LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 info LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 
#/usr/local/lsws/phpbuild/buildphp_manual_run.sh
wait about until the process finished (it will shown **COMPLETE** status) and apply changes and Graceful restart
Check your PHP installation status
http://yourip/phpinfo.php
or
Source codecode LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 printer LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 info LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 
#/usr/local/lsws/fcgi-bin/lsphp5 -v
Additional Modules
Install IonCube Loader
32bit OS:
Source codecode LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 printer LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 info LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 
#wget http://downloads2.ioncube.com/loader_downloads/ioncube_loaders_lin_x86.tar.gz
#tar -zxvf ioncube_loaders_lin_x86.tar.gz
#cd ioncube
#mv ioncube/ioncube_loader_lin_5.3.so /usr/lib/extensions/no-debug-non-zts-20090626/
64bit OS:
Source codecode LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 printer LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 info LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 
#wget http://downloads2.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
#tar -zxvf ioncube_loaders_lin_x86-64.tar.gz
#mv ioncube/ioncube_loader_lin_5.3.so /usr/lib64/extensions/no-debug-non-zts-20090626/
Install Suhosin Extension
Source codecode LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 printer LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 info LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 
#wget http://download.suhosin.org/suhosin-0.9.32.1.tar.gz
#tar -zxvf suhosin-0.9.32.1.tar.gz
#cd suhosin-0.9.32.1
#/usr/local/lsws/lsphp5/bin/phpize
#./configure --enable-suhosin --with-php-config=/usr/local/lsws/lsphp5/bin/php-config
#make
#make install
Create folder cache file eAccelerator
Source codecode LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 printer LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 info LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 
#mkdir /tmp/eaccelerator
#chmod 0777 /tmp/eaccelerator
Edit php.ini
32bit OS:
Source codecode LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 printer LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 info LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 
#cp /usr/local/lsws/php/php.ini /usr/lib
#nano /usr/lib/php.ini

64bit OS:
Source codecode LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 printer LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 info LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 
#cp /usr/local/lsws/php/php.ini /usr/lib64
#nano /usr/lib64/php.ini
Add config on php.ini:
32bit OS:
Source codecode LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 printer LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 info LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 
zend_extension="/usr/lib/extensions/no-debug-non-zts-20090626/ioncube_loader_lin_5.3.so"
zend_extension="/usr/lib/extensions/no-debug-non-zts-20090626/eaccelerator.so"
eaccelerator.shm_size= 16
eaccelerator.cache_dir="/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"
extension="/usr/lib/extensions/no-debug-non-zts-20090626/suhosin.so"
64bit OS:
Source codecode LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 printer LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 info LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 
zend_extension="/usr/lib64/extensions/no-debug-non-zts-20090626/ioncube_loader_lin_5.3.so"
zend_extension="/usr/lib64/extensions/no-debug-non-zts-20090626/eaccelerator.so"
eaccelerator.shm_size= 16
eaccelerator.cache_dir="/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"
extension="/usr/lib64/extensions/no-debug-non-zts-20090626/suhosin.so"
Restart LiteSpeed:
Source codecode LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 printer LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 info LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 
#/usr/local/lsws/bin/lswsctrl restart
#/usr/local/lsws/fcgi-bin/lsphp5 -v

PHP 5.3.5 (litespeed) (built: Apr 23 2011 19:21:41)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
with the ionCube PHP Loader v4.0.8, Copyright (c) 2002-2011, by ionCube Ltd., and
with eAccelerator v0.9.6.1, Copyright (c) 2004-2010 eAccelerator, by eAccelerator
with Suhosin v0.9.32.1, Copyright (c) 2007-2010, by SektionEins GmbH
Create virtual host and add Domain:

Source codecode LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 printer LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 info LiteSpeed Standard Edition, PHP, and MySQL on CentOS 5 
#useradd domain.com
#passwd domain.com
#mkdir /home/domain.com/public_html /home/domain.com/cgi-bin /home/domain.com/logs
#chown -R domain.com:domain.com /home/domain.com
#chmod 755 -R /home/domain.com
Now go to litespeed admin panel
Click on Configuration –-> Virtual Host Template –-> PHP_SuEXEC
Click General tab and click edit on Template Setting
set configuration like this :

Virtual Host Root: /home/$VH_NAME/
Config File: $SERVER_ROOT/conf/$VH_NAME.xml
Max Keep-Alive Requests: -
Smart Keep-Alive: Yes
Document Root: $VH_ROOT/public_html/
Enable GZIP Compression: Yes
Enable IP GeoLocation: Not Set
Administrator Email: your email
apply changes and do gracefull restart
Add domain:
Go to Configuration – Virtual Host Templates, choose PHP_SuEXEC
Go to Template tab and add Member Virtual Hosts
Virtual Host Name: domain.com
Domain: domain.com
Aliases: domain.com
Virtual Host Root: /home/domain.com/
apply changes and do gracefull restart
Source:  http://fr3akz.com
Read More