Thursday, May 24, 2007

Installing IonCube Loader

1. Download the program and store it on your server using wget or FTP.

2. Unpack the program
tar -zxvf ioncube_loaders.tar.gz

3. cd ioncube

4. copy ioncube-install-assistant.php to a web directory such as your hosting directory and open it in your browser window.
cp ioncube-install-assistant.php /home/userdirectoryhere/www

5. Now lets move the iconcube directory to a permanent location:

cd ..
mv ioncube /usr/local

6. Now that you know the location of php.ini you need to edit it.
pico /usr/local/lib/php.ini

Now find where other zend extentions are in the file.
ctrl + w: zend_extension

Paste in your new line for ioncube loader
zend_extension = /usr/local/ioncube/

(NOTE) Check php version if it is 5.2 then entry should be

7. Save the changes
ctrl + X then Y and enter

8. Restart the web server to take effect.
/etc/init.d/httpd restart

Ninad S

Tuesday, May 22, 2007

What is RAID (Redundant Array of Independent Disks)?

RAID is a type of disk, where several physical disks are combined into an array for better speed and fault tolerance. RAID 0 implements data striping where file blocks are written to separate drives. RAID 0 does not provide fault tolerance, because failure of one drive will result in data loss. RAID 1 implements data mirroring. Data is duplicated on two drives either through software or hardware. It provides faster read performance than a single drive.

Ninad S

Monday, May 21, 2007

Cron to delete mails from Inbox

Here is the syntax for deleting all email in the inbox of the default email address for a website:

echo -n > /home/youraccount/mail/inbox

Ninad S

Send Email from a PHP Script Using SMTP Authentication

To connect to an outgoing SMTP server from a PHP script using SMTP authentication and send an email:

Adapt the example below for your needs. Make sure you change the following variables at least:
* from: the email address from which you want the message to be sent.
* to: the recipient's email address and name.
* host: your outgoing SMTP server name.
* username: the SMTP user name (typically the same as the user name used to retrieve mail).
* password: the password for SMTP authentication.
require_once "Mail.php";

$from = "Bill Sender ";
$to = "Ninad Recipient ";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";

$host = "";
$username = "smtp_username";
$password = "smtp_password";

$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject);
$smtp = Mail::factory('smtp',
array ('host' => $host,
'auth' => true,
'username' => $username,
'password' => $password));

$mail = $smtp->send($to, $headers, $body);

if (PEAR::isError($mail)) {

" . $mail->getMessage() . "

} else {

Message successfully sent!

Ninad S

Saturday, May 19, 2007

Google AdSense Account Disabled

Hello Ninad Shirgaonkar,

It has come to our attention that invalid clicks and/or impressions
have been generated on the Google ads on your site(s). We have
therefore disabled your Google AdSense account. Please understand that
this was a necessary step to protect the interests of AdWords

As you may know, a publisher's site may not have invalid clicks or
impressions on any ad(s), including but not limited to clicks and/or
impressions generated by:

- a publisher on his own web pages
- a publisher encouraging others to click on his ads
- automated clicking or surfing programs, or any other deceptive
- a publisher altering any portion of the ad code or changing the
layout, behavior, targeting, or delivery of ads for any reason

These or any other such activities that violate Google AdSense Terms
and Conditions and program polices may have led us to disable your
account. The Terms and Conditions and program polices can be viewed at:

If you have any questions about invalid activity or the action taken on
your account, please do not reply to this email. You can find more
information by visiting


The Google AdSense Team

How to increase file limit

Get current limit:

ulimit -n

cat /proc/sys/fs/file-nr

The default limit is 1024.

Get current number of open file descriptors:

lsof [-p pid] | wc -l

Increase the limit:

Edit /etc/security/limits.conf:

username hard nofile 32768


Ninad S

Friday, May 11, 2007

Postfix + ClamAV + MailScanner in OpenSuse 10.2

1) Install the anti virus software (Clamav) –> (here)
rpm -ivh clamav-db-0.88.2-1.i386.rpm
rpm -ivh clamav-devel-0.88.2-1.i386.rpm
rpm -ivh clamav-server-0.88.2-1.i386.rpm
rpm -ivh clamav-0.88.2-1.i386.rpm

/etc/init.d/clamd start

2. Once the anti-virus is install then we need to install the MailScanner software the RPM along with the source files can be found at

Now get ready to install the mailscanner, this is going to take a long time.

gzip -d MailScanner-4.46.2-2.rpm.tar.gz
tar -xvf MailScanner-4.46.2-2.rpm.tar
cd MailScanner-4.46.2-2

3. In your MailScanner.conf file in /etc/MailScanner, there are 5 settings you need to change. The settings are:

Run As User = postfix
Run As Group = postfix
Incoming Queue Dir = /var/spool/postfix/hold
Outgoing Queue Dir = /var/spool/postfix/incoming
MTA = postfix

4. You will need to ensure that the user “postfix” can write to

/var/spool/MailScanner/incoming and /var/spool/MailScanner/quarantine

chown postfix:postfix /var/spool/MailScanner/incoming
chown postfix:postfix /var/spool/MailScanner/quarantine

5. Edit file MailScanner.conf
Virus Scanners = clamav

6. Edit virus.scanners.conf
clamav /usr/lib/MailScanner/clamav-wrapper /var/lib/clamav

7. Now we need to edit the postfix file, go all the way to the bottom of the file and add the following
header_checks = regexp:/etc/postfix/header_checks

8. In the file /etc/postfix/header_checks add this line:
/^Received:/ HOLD

9. Set the servers to run on startup and then start them

chkconfig MailScanner on
chkconfig postfix on
chkconfig clamd on

/etc/init.d/Mailscanner start
/etc/init.d/postfix start
/etc/init.d/clamd start


Ninad S

How To use Yum

  • To seach for a application

Yum will search all your enabled repos and tell you where you can obtain the package from

yum search application_name
  • Yum can list all available packages from your enabled repos and tell you where you can obtain the package from:
yum list available
  • To find out more info about some package
yum info application_name
  • Installing applications

Inastalling is as easy as

yum install application_name
  • Listing rpms

yum can list installed rpms for you from the repos you have enabled

yum list extras
  • Removing rpms

Yum can remove a application and the dependenciesit installed with tat application. it will not remove depenencies if another application installed needs them.

yum remove application_name
  • Updating the system

Yum can update the system for you with out user interact if you want it to.

yum update
  • Not sure if you have upates?
yum check-update
  • Local install

downloaded a rpm and cannot install it with rpm because of dependencies?

yum localinstall /path/to/the/rpm


Ninad S

Thursday, May 10, 2007

To view the .html first instead of .php

Add the code in .htaceess as DirectoryIndex index.html

Ninad S

To turn off register globals for a particular user.

Put the code in .htaccess
php_flag register_globals off


Ninad S

How to Set wildcard DNS

Edit the httpd.conf and add the line in virtual host of domain.

ServerAlias * www.*

restart httpd/apache service.

Now edit the DNS file or db file of domain and add the line as

* 14400 IN A IP of server
www.* 14400 IN A IP of server

restart named service


Ninad S

Find out what messages are waiting for delivery?

To list the number of messages, use:

exim -bpc

To list all the messages in the queue, use:

exim -bp

To get a summary of all the messages waiting for delivery, use:

exim -bp|exiqsumm -c

This will produce a summary of all messages, listed in order of quantity to each destination (domain).


Ninad S

Nagios Installation and Configuration

You can use the following steps to install and configure Nagios.

Create the base directory where you would like to install Nagios.
mkdir /usr/local/nagios

Add a new user (and group) to your system.
adduser nagios

Download Nagois 1.0.
tar -zxvf nagios-1.0.tar.gz
cd nagios-1.0

Run the configure script.
./configure –prefix=/usr/local/nagios –with-cgiurl=/nagios/cgi-bin
–with-htmurl=/nagios/ –with-nagios-user=nagios –with-nagios-grp=nagios

Compile Nagios and the CGIs.
make all

Install the binaries and HTML files (documentation and main web page).
make install

Install the sample init script to /etc/rc.d/init.d/nagios.
make install-init

Installing the Plugins

In order for Nagios to be of any use to you, you’re going to have to download
and install some plugins. Plugins are scripts or binaries which perform all
the service and host checks that constitute monitoring

Download and install the Nagios Plugins.
rpm -Ivh nagios-plugins-1.3.1-1.9.i386.rpm

Configuring Nagios

Nagios is compiled and installed. Now we have to configure it or in other
words define objects (hosts, services, etc.) that should be monitored.

The main configuration file (/usr/local/nagios/etc/nagios.cfg) contains a
number of directives that affect how Nagios operates. This config file is
read by both the Nagios process and the CGIs. This is a sample nagios.cfg


Add the list of servers that you want to monitor in

# ’server42′ host definition
define host{
use generic-host
host_name (server hostname)
alias (hostname)
address IP Address
check_command check-host-alive
max_check_attempts 10
notification_interval 120
notification_period 24×7
notification_options d,u,r
# ’server43…..


Edit /usr/local/nagios/etc/hostgroups.cfg to add all the servers.

define hostgroup{
hostgroup_name tchosting
alias TotalChoice
contact_groups tchosting
members server40,server41,server42

To setup email and pager notifications edit
/usr/local/nagios/etc/contacts.cfg to add your contact info.

define contact{
contact_name Ninad
alias ninad
service_notification_period 24×7
host_notification_period 24×7
service_notification_options n
host_notification_options d,u,r
service_notification_commands notify-by-email
host_notification_commands host-notify-by-email

The contact name must be a member of contact group. Edit
/usr/local/nagios/etc/contactgroups.cfg to add your name.



zlib installation


tar -zxvf zlib-1.2.3.tar.gz
cd zlib-1.2.3
make install


Ninad S

Missing DNS zone ?

If you are facing issue related to missing DNS zone with cpanel update do the following:

/scripts/perlinstaller Compress::Raw::Zlib
/scripts/perlinstaller –force Scalar::Util

This should fix the issue.


Ninad S

Wednesday, May 9, 2007

WHM not updating quotas

The binary /usr/sbin/repquota must be missing onthe server which is used by the Cpanel script /usr/local/cpanel/bin/cachedrepquota to write to the file

After copying this binary and executing this script and restarting Cpaneld ,
the issue should be resolved.


Ninad S

Accounts missing from WHM

There are a lot of causes if the accounts in the server are missing from WHM-->list accounts.

Any of the following will cause the issue.

1) The account is missing from httpd.conf

2) The account has no cpanel user file.

3) The account is not there in the following files.
/etc/localdomains, /etc/userdomains, /etc/trueuserdomains and /etc/trueuserowners

/etc/trueuserowners file specifies the owner of each accounts in the following manner.

user: owner

4) If the account's DNS conflicts. ie if the domain has 2 DNS entries such as domainname and www.domainname. It may cause the account not listed in WHM-->list accounts.

You can run the following script if the account is missing.

/scripts/updateuserdomains (It won't add the account in httpd.conf, that
you have to add manually)


Ninad S

Not able to view JSP pages

If you are getting code instead of JSP page then you need to install servlets.

To install servlet go to the WHM >> Account Functions >> Install Servlets. Select domain and install.

After doing this you need to restart tomcat.

Now you will be able to view JSP pages.


Ninad S

Sunday, May 6, 2007

Enabling FP extensions for an addon domain

HowTo enable FP extensions for an addon domain
A) We won’t be able to install FP extensions on addon domain basically for
two reasons.

1) There won’t be a ServerName entry for the addon domain in the Apache config file and hence the install program will show an error like
the “domain” is not a valid virtual server.

2) FrontPage extension install program won’t install extensions in a directory which comes under another domains web root having FP extensions already installed.

To overcome these hurdles you can do the following.

1) Comment out the existing ServerName entry for the subdomain.

2) Create a new ServerName entry for in the corresponding subdomain’s VirtualHost entry.

3) Create a temporary folder in the document root of main domain and MOVE all .htaccess* and _* files from public_html in to the new directory.

4) Remove the _* and .htaccess files(created by FP) from the addon domain’s folder.

5) Verify the access.conf file in apache config directory and ensure that the AllowOverride directive is set to ‘All’. Some times this will not be enough for us to continue, hence, you have to make sure that the AllowOverride is set to ‘All’(by default it will
be ‘None’) in Apache config file.
Change only the directive inside entry.

6) Restart Apache and run the install program from back end.

#/usr/local/frontpage/version5.0/bin/owsadm.exe -o install -u $USERNAME -xuser $USERNAME -xgroup $USERNAME -p 80 -m $DOMAIN -pw $PASSWORD -s /usr/local/apache/conf/httpd.conf
$USERNAME give control panel login name
$DOMAIN give addon domain use
$PASSWORD choose a password

7) Restore the changes you made in the Apache config file.

Cool Move the .htaccess* and _* files from the backup directory (main domain web root).

If you are still having problems with connecting to the server using
FrontPage please make sure that the server name is http://www.addondomainname and you may also want to close the FP program and
start again to clear cache.


Ninad S

WHM not updating quotas

The binary /usr/sbin/repquota is missing onthe server which is used by the Cpanel script /usr/local/cpanel/bin/cachedrepquota to write to the file

After copying this binary and executing this script and restarting Cpanel ,
the issue should be resolved.


Ninad S

Synchronize time on Cpanel servers

Command to Synchronize time on Cpanel servers

rdate -s


Ninad S

PHP5 install as CGI

1) Download PHP 5.1.2 and do the usual

cd /usr/local/src
tar -jxvf php-5.2.1.tar.bz2

2) Compile php as in a new directory such as /usr/local/php5

Use the same ./configure line required but with the following changes:

–with-config-file-path=/usr/local/php5/etc –prefix=/usr/local/php5 –with-mysqli=/usr/bin/mysql_config (only with Mysql 4.1)

3) Compile and install
make install

IMP Steps :

cp php.ini-dist /usr/local/php5/etc/php.ini
cp /usr/local/php5/bin/php /usr/local/cpanel/cgi-sys/php5
chown root:wheel /usr/local/cpanel/cgi-sys/php5

4) Edit httpd.conf and add lines below::

AddHandler application/x-http-php5 .php5
Action application/x-http-php5 /cgi-sys/php5

Just use .php5 and it will invoke php5.


Ninad S

How do I check how many messages are in the mail queue?

This can be done by typing in the following command:


Ninad S

Disable PHP Functions

Edit php.ini

Comment out the original disable_functions, then put this underneath

disable_functions = dl,passthru,proc_open,proc_close,shell_exec,system

/etc/rc.d/init.d/httpd restart


Ninad S

How to disable mod_security for an individual account ?

If you are receiving the error for mod_security, access denied with error code 403 when you check the error logs for any account. You can disable the mod_security for that account by adding a simple code in his .htaccess


SecFilterEngine Off
SecFilterScanPOST Off



Ninad S

How to Update stats on Plesk server

Run the following command to update stats on plesk server.



Ninad S

How to Install RvSkin


Create a account from whm called

1. SSH as root to server that was registered while purchasing the license and run:

mkdir /root/rvadmin

cd /root/rvadmin

wget; bunzip2 -d rvauto.tar.bz2; tar -xvf rvauto.tar; perl /root/rvadmin/

Answer a couple of questions on your shell, and wait until it finishes. First installation will take 2- 5 minutes to install. Installer will create a new hosting account ‘rvadmin’. Don’t terminate it. It will be used for internal RVSkin configuration management.

2. Log in to RVSkin Manager. Both root and reseller are able to access RVSkin Manager in WHM / Add-ons (at the bottom left menu). If you cannot find the RVSkin Manager menu, please close WHM and open it again.

If there is no messages display on the skin, please run this command on your SSH.

rm -f /usr/local/cpanel/Cpanel/rvversion
perl /root/rvadmin/

3. In RVSkin Manager:

* Set global configuration
* Set default language
* Create defaul feature list for user and for reseller
* Set tweak setting, reseller feature control, body links, top links, help, tutorial links, and etc.
* Test configuration setting in 2 hosting accounts.
* rvadmin: this account can consider to be account belong to root
*reseller’s client: this account will reflect setting from reseller skin manager. If it is not configued, it will remain anonymous.

4. Change user cPanel to RVSkin themes
5. Change cPanel language to the new language


Ninad S

How to enable/disable PING

To Enable PING on the server

echo “0″ >> /proc/sys/net/ipv4/icmp_echo_ignore_all

To Disable PING on the server

echo “1″ >> /proc/sys/net/ipv4/icmp_echo_ignore_all


Ninad S

RAM disk

A RAM disk is a portion of RAM which is being used as if it were a disk drive. RAM disks have fixed sizes, and act like regular disk partitions. Access time is much faster for a RAM disk than for a real, physical disk. However, any data stored on a RAM disk is lost when the system is shut down or powered off. RAM disks can be a great place to store temporary data.The Linux kernel version 2.4 has built-in support for ramdisks. Ramdisks are useful for a number of things, including:

  • Working with the unencrypted data from encrypted documents
  • Serving certain types of web content
  • Mounting Loopback file systems (such as run-from-floppy/CD distributions)

Ninad S

Steps for Kernel Upgrade

Following are steps to upgrade kernel on live servers.

1. Check current version of kernel on server using command uname -a, if
its 2.4 then download latest release for 2.4 please do not download 2.6
You can download kernel from
if its 2.4 then, you can
check latest stable release from

2. wget kernel in /usr/local/src
3. untar it using tar -zxvf linux-2.x-xxxx
4. cd linux-2.x-x
5. make clean
6. make mrproper
7. If kernel is 2.4 then copy current version of config file from
/boot/config-’uname-r’ as .config in /usr/local/src/linux-2.x-xx, if
kernel is 2.6 then you do not need to make .config in current directory
8. make menuconfig, select and check if all required modules are
also make sure that your kernel supports multiple cpu
you can check it and select from processor type, if it displays support
for more then 2 kernel then you do not need to modify anything there.
9. save configuration and exit
10. make modules if kernel is 2.4 then need to run make dep before
make modules
11. make modules_install
12. make
13. if 2.4 kernel then need to run make bzImage and then make install,
you can directly run make install if kernel is 2.6
15. now make sure bootloader and modify default kernel accordingly
grubby –bootloader-probe if it displays grub then edit /etc/grub.conf
if its lilo then edit lilo.conf and make compiled kernel as default
16. If your boot loader is lilo then you need to run one more command
/sbin/lilo which will update lilo
17. now its time to reboot server


Ninad S

Lost Mysql root password ?

Few Simple steps to change your mysql root password.

service mysql stop

wait until MySQL shuts down. Then run

mysqld_safe –skip-grant-tables &

then you will be able to login as root with no password.

mysql -uroot mysql

In MySQL command line prompt issue the following command:

UPDATE user SET password=PASSWORD(”abcd”) WHERE user=”root”;

At this time your root password is reset to “abcd” and MySQL will now
know the privileges and you’ll be able to login with your new password:

mysql -uroot -pabcd mysql


Ninad S

How do you password protect your pages?

Using a password protected folder. With this method, you create the passwords ans usernames, and let users (members) have them. This method is used when a limited number of users will use the site.

Go the cpanel >> Password protection >> Select the name of the directory that you wish to protect >> Check the folder requires a password to access via http:// give a name such as Members now go back and create a user and password. Now when visitors will create this directory they will be prompted for username and password.

Ninad S

Using RPM

Installing software (rpm -i)
rpm -ivh package.rpm

Uninstalling software (rpm -e)
rpm -e software name

Updating packages (rpm -U)

Note :: This will uninstall and install the new package avoiding this annoying messages. It is also usual to install packages with –U flag in this way:

rpm -Uvh software.rpm

Ninad S

How to Install Mod_evasive

cd /root


tar xvfz mod_ev*

cd mod_evasive*

CPANEL & Apache 1

/usr/local/apache/bin/apxs -i -a -c mod_evasive.c

/etc/init.d/httpd restart

CPANEL & Apache 2

/usr/local/apache/bin/apxs -i -a -c mod_evasive20.c

/etc/init.d/httpd restart

PLESK & Apache 1

/usr/sbin/apxs -i -a -c mod_evasive.c

/etc/init.d/httpd restart

PLESK & Apache 2

/usr/sbin/apxs -i -a -c mod_evasive20.c

/etc/rc.d/init.d/httpd restart


Ninad S

To view Stats without login to cpanel

You can view webalizer stats without login to your cpanel.

cd /home/user/www
mkdir stats
cd stats
ln -s /home/user/tmp/webalizer webalizer
cd ../
chown -R user:user stats
cd ../
chmod -R 0775 tmp

You can access it as http://domain/stats/


Ninad S

Port Forwarding

To forward port 411 to port 4411

/sbin/iptables -t nat -A PREROUTING -p tcp -i eth0 -d –dport 411 -j DNAT –to

/sbin/iptables -A FORWARD -p tcp -i eth0 -d –dport 4411 -j ACCEPT


Ninad S

Cpanel license error

If you are getting cpanel license error then run this command


If that doesnt clear it the first time, remove the file called “lisc” in
/usr/local/cpanel and then run that cpkeyclt again


Ninad S

Zend Optimizer

For i386
tar xvfz ZendOptimizer-3.0.2-linux-glibc21-i386.tar.gz
cd ZendOptimizer-3.0.2-linux-glibc21-i386

For x86_64
tar xvfz ZendOptimizer-3.0.1-linux-glibc23-x86_64.tar.gz
cd ZendOptimizer-3.0.1-linux-glibc23-x86_64


Ninad S


cd /usr/local/src
mkdir ea
cd ea

tar zxvf eaccelerator-0.9.5.tar

cd eaccelerator-0.9.5

export PHP_PREFIX=”/usr”
./configure –enable-eaccelerator=shared –with-php-config=$PHP_PREFIX/bin/php-config
make install

For PLESK: vi /etc/php.ini

For CPANEL: vi /usr/local/lib/php.ini

If Zend is already installed, vi /usr/local/Zend/etc/php.ini

Find this:

;Windows Extensions

Above this, comment out the PHPA or ZEND lines if you have them. Replace them with this:


mkdir /tmp/eaccelerator

chmod 0777 /tmp/eaccelerator

service httpd restart


Ninad S

Lame Server Resolve

service named stop

vi /etc/named.conf

add the three lines at the top

logging {

category lame-servers { null; };


service named restart


Ninad S

Open DNS Servers

vi /etc/named.conf

Before the line that says “directory /var/named”; (it could be /var, /var/named, etc)
recursion no;

service named restart

Make sure you can ping and afterwards.


Ninad S

Configuring APF Firewall

cd /usr/local/src
tar -zxf apf-current.tar.gz
cd apf-0.*

Now edit config file
vi /etc/apf/conf.apf
Scroll down to the “Common ingress (inbound) TCP ports section. At this point you need to find the correct configuration for your control panel.



save the file
start apf
apf -s
If everything still works then edit the config file and turn dev mode off. Make sure you can start a new ssh session before changing dev mode off. If you are kicked out you need to go back and look at what caused the problem!

restart APF
apf -r


Ninad S

SIM (System Integrity Monitor)

How to Install SIM

Login to your server via SSH as root.


tar xvfz sim-3*.gz

cd sim-3.0

./ -i


sim -j

If ifconfig is not eth0 (eg eth1, or venet0)

nano -w /etc/conf.sim


Ninad S

Install Chkrootkit

cd /root


tar xvzf chkrootkit.tar.gz

mv chkrootkit-* chkrootkit

cd chkrootkit

make sense



View My Stats