MyTrueHost launched Web Hosting for Indian clients just in Rs 60/Month with various payment options(netbanking, debit card, credit card,cash card or paypal).
Please Visit at https://www.mytruehost.in

Installation of php Memcache onto cPanel running CentOS

Make the Sources Folder

mkdir ~/memcache

Compile and Install LibEvent

cd ~/memcache
wget http://www.monkey.org/~provos/libevent-1.4.9-stable.tar.gz
tar xvfz libevent-1.4.9-stable.tar.gz
cd libevent-1.4.9-stable
./configure
make
make install

Compile and Install Memcache

cd ~/memcache
wget http://www.danga.com/memcached/dist/memcached-1.2.6.tar.gz
tar xvfz memcached-1.2.6.tar.gz
cd memcached-1.2.6
./configure –with-lib-event=/usr/local/
make
make install

Starting Memcache

memcached

If you get the following error then you may beed to register libevent:
error while loading shared libraries: libevent-1.4.so.2: cannot open shared object file: No such file or directory

Register LibEvent

vi /etc/ld.so.conf.d/libevent-i386.conf
Open above file and put the line /usr/local/lib/ and save the file and fire below command.
ldconfig

Installing PHP Memcache

cd ~/memcache
wget http://pecl.php.net/get/memcache-3.0.3.tgz
tar xvfz memcache-3.0.3.tgz
cd memcache-3.0.3
phpize
./configure
make
make install
vi /usr/local/lib/php.ini
–[paste]–
extension=memcache.so
–[/paste]–
service httpd restart

Thats All….

 

cpanel/whm license error

First, check the license on http://verify.cpanel.net/ to ensure it is still licensed.
If it is not, please contact who you purchase the license from directly.

If it says it is valid, try the following as root via SSH:

/etc/init.d/firewall stop
rdate -s rdate.cpanel.net
/usr/local/cpanel/cpkeyclt
/etc/init.d/firewall start

 

Installation of ionCube Loader

1. Download the program and store it on your server using wget or FTP.
http://www.ioncube.com/loader_download.php

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

Then open it http://www.yourdomain.com/ioncube-install-assistant.php
The output should be something similar to:

Analysis of your system configuration shows:

PHP Version 4.3.3
Operating System Linux
Threaded PHP No
php.ini file /usr/local/lib/php.ini
Required Loader ioncube_loader_lin_4.3.so

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/ioncube_loader_lin_4.3.so

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

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

Success! You should now see a section in your PHP Info page that says:
Additional Modules
Module Name ionCube Loader

 

Some useful linux commands

1) Backup download

–>> rsync -av –progress –rsh=”ssh -l 3ixteam” star/ 66.7.205.226:star/

2) To block 25 port by IP

–>>

root@server [~]# cat test
netstat -n -p|grep 25|awk ‘{print $5}’|awk -F: ‘{print $1}’|sort|uniq|awk ‘{print “csf -d ” $1″/24″}’
root@server [~]#
3) To check pl file on the server(usernname)

–>>

tail -f /var/log/messages | grep ftp | grep *.pl

 

4) TO CHECK THE DISK SPACE

find -name ‘.pureftpd-upload*’ | xargs rm –f >> Delete file from user’s home folder

find -name ‘.pureftpd-upload*’ |awk ‘{print “rm -rf ” $9}’ >> Print Output from user’s home folder
find /home -type f -name ‘.pureftpd-upload*’ >> Checkes halfway uploaded files on server

find /home -type f -name ‘.pureftpd-upload*’ | xargs rm -f >> finds halfway uploaded files to server and deletes the files.

find /home -type f -name ‘.pureftpd-upload*’ |awk ‘{print “rm -rf ” $9}’ >> Prints output
ll |grep nobody |awk ‘{print “rm -rf ” $9}’ >> to delete nobody files from /tmp

find /tmp -type f -name ‘sess_*’ | xargs rm –f >> to delete session files.

ps -auxf |grep $1|awk ‘{print “kill -9 ” $2}’ >> Killwhom

Exim Spam : egrep “X-PHP-Script” * -R

 

httpd is not working: Unable to open logs

root@server# /etc/init.d/httpd restart
Warning: DocumentRoot does not exist
httpd not running, trying to start
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs

Solution :–

root@server [~] netstat -lnp | grep ‘0.0.0.0:80’

tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      10240/httpd

root@server[~] kill -9  10240

root@server[~] service httpd restart

thats all.

httpd is not working : semget: No space left on device

PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/local/lib/php/extensions/no-debug-non-zts-20060613/php_msql.dll’ – /usr/local/lib/php/extensions/no-debug-non-zts-20060613/php_msql.dll: cannot open shared object file: No such file or directory in Unknown on line 0
semget: No space left on device

Solution :–

ipcs -s

for i in `ipcs -s | awk ‘/nobody/ {print $2}’`; do (ipcrm -s $i); done

OR

ipcs -s | grep apache | perl -e ‘while (<STDIN> ) { @a=split(/\s+/); print `ipcrm -s $a[1]`}’

and then  restart Apache service

 

Changing the default nameservers for new accounts.

1)

You add/change your private nameserver for your dedicated server but when you create account through whm it not shows your default nameserver. You have to
add your private nameserver in wwwacct.conf
# vi /etc/wwwacct.conf
Add or edit following lines as per your requirement.
ns = ns1.domain.com
ns2 = ns2.domain.com

save the file. Now when you create account through whm it shows your servers default nameserver.

2)
If reseller client want his private nameserver add automatically when he create account through whm.

Go to whm >> Resellers >> Reseller Center

Select reseller account from dropdown list.
Click on edit privileges / Nameservers

Scroll down to the bottom of the screen and enter the name of the reseller nameserver in the blank field next to Primary nameserver and secondary nameserver
as per below.

Primary nameserver = ns1.domain.com
Secondary nameserver = ns2.domain.com

Click on save option.

Now when reseller creates account through whm it shows resellers private nameserver.

 

Secure the /tmp Directory

The following is how to secure your /tmp directory on your Dedicated Server using a cPanel Script.
You MUST have cPanel installed for this to work.

1. Login to your server as root via SSH.
2. Type: /scripts/securetmp

That’s it your done. cPanel wrote that script to allow users to secure their /TMP Directory very easily.

 

Configuring the Timezone on your Dedicated Server

The timezone is set by the file /etc/localtime. In order to set this up corectly on your Dedicated Server you will need to first remove /etc/localtime and
then create a symlink to the correct zonefile in /usr/share/zoneinfo. You will then want to run ntpdate to sync up properly.

cd /etc
rm -rf localtime
ln -s /usr/share/zoneinfo/America/New_York localtime
ntpdate -b ntp.carohosting.com

Just replace “America/New_York” with whatever timezone file you want in /usr/share/zoneinfo.

 

Email notification of Root Login

Keeping track of who logs into your Dedicated Server and when is very important, especially when you’re dealing with the super user account. We recommend that you use an email address not hosted on the server your sending the alert from.

So lets get started!

1. Login to your server and su to root.

2. cd /root

3. vi .bashrc

4. Scroll to the end of the file then add the following:
echo ‘ALERT – Root Shell Access (YourserverName) on:’ `date` `who` | mail -s “Alert: Root Access from `who | cut -d'(‘ -f2 | cut -d’)’ -f1`” you@yourdomain.com

Replace YourServerName with the handle for your actual server
Replace you@yourdomain.com with your actual email address

5. Save and exit vi (:wq)

Now logout of SSH, close the connection and log back in! You should receive an email address of the root login alert a few minutes afterwards.

Note: This is a great tool for Dedicated Servers that have multiple admins or if you give someone SSH access for whatever reason, although you should give out the root password to as few people as humanly possible and be sure to change it often.