How do I enable innoDB storage engine?

You can enable InnoDB by accessing your server via SSH as root ( or another account then use su or sudo to gain root access). Once that is done, check /etc/my.cnd for an entry like:

skip-inndob

If such an entry exists, remove or comment out the entry and restart MySQL.

If such an entry does not exist, then there are other problems for which we will need more information.


Once InnoDB is enabled, you can make it the default table type by specifying the following in /etc/my.cnf:

default-table-type=innodb

Enjoy:)

Setup Your Nameservers on Directadmin

To setup your nameservers, simply do the following:

- Login to your DirectAdmin panel as "admin"
- Go to your IP Management section, and add two new IP addresses
- Once they are added, click the check boxes next to the two IPs that you've just submitted. Assign these IPs to "admin"
- Now go to your Reseller panel, and navigate to your Nameserver section
- On this page, create your two nameservers, generally ns1. and ns2.
- Finally, go back to your Admin panel and go to your Administrator Settings page. Set your nameservers to the ones you have just created and save your changes.

Enjoy:)

Checking the configuration of named.conf and zone files

It is sometimes easy to make changes in named.conf file or in any zone files manually though the control panel has options to modify them. If the changes are being made manually, we should also make sure that the configuration as well as the zone files are not being messed up.

The bind package has utilities to check the syntax of named.conf and any zone files. We can make use of those binaries to check our modifications done to those files before reloading or restarting named service.

To check the sytax of zone file /var/named/kb.com.db for the domain kb.com,

[root@bash ~]# named-checkzone kb.com /var/named/kb.com.db
zone kb.com/IN: loaded serial 2006032401
OK
[root@ bash~]#


If everything is correct, it will show the serial number with which the zone file is loaded. Otherwise, it will give error message indicating the line number at which the error occured.

To check the syntax of named.conf file,

[root@bash ~]# named-checkconf /etc/named.conf
[root@bash~]#

You may also load the configuration of all master zones listed in named.conf at the time of checking the syntax as,

[root@bash ~]# named-checkconf -z /etc/named.conf
zone localdomain/IN: loaded serial 42
zone localhost/IN: loaded serial 42
zone 0.0.127.in-addr.arpa/IN: loaded serial 1997022700
zone 255.in-addr.arpa/IN: loaded serial 42

zone 0.in-addr.arpa/IN: loaded serial 42
zone kb.com/IN: loaded serial 2006032401
[root@bash ~]#

The command will show a detailed output in case any error in named.conf file.

This way we can make sure that we are not editing the configuration file wrongly.

Enjoy:)

Script for deleting all the mails in Qmail

create a file with the following statements, say frozen

service qmail stop
find /var/qmail/queue/mess -type f -exec rm {} \;
find /var/qmail/queue/info -type f -exec rm {} \;
find /var/qmail/queue/local -type f -exec rm {} \;
find /var/qmail/queue/intd -type f -exec rm {} \;
find /var/qmail/queue/todo -type f -exec rm {} \;
find /var/qmail/queue/remote -type f -exec rm {} \;
service qmail start

You may also include the directories like /var/qmail/queue/mess/bounce... etc.
2. Give executable permission to this file

chmod 755 frozen

3. Execute the script

sh frozen

Enjoy:)

Qmail error 'qmail: alert: cannot start: unable to open mutex'

If an error "qmail: alert: cannot start: unable to open mutex" is encountered while starting qmail.

Proceed with the following steps to fixing the error:-

1. Check the result of tail -f /var/log/messages as well as tail -f /var/log/maillog

If you can't trace the error from log files, please run the binary from /var/qmail/bin.

[root@serv ~]#cd /var/qmail/bin
[root@serv ~]#./qmail-send


2. If the error is something like "alert: cannot start: unable to open mutex"

[root@serv ~]# touch /var/qmail/queue/lock/sendmutex
[root@serv ~]# chown qmails:qmail /var/qmail/queue/lock/sendmutex


3.Restart qmail using the command

[root@serv ~]# /etc/rc.d/init.d/qmail start

Enjoy:)

IMAP Error (Connection dropped by IMAP server)

To troubleshoot the IMAP error(Inbox lock errors) while accessing mailbox via any webmail clients(Horde, SquirrelMail, NeoMail, Round Cube etc.):

The error will be shown as below,

Connection dropped by IMAP server

ERROR: Connection dropped by IMAP server.
Query: SELECT "INBOX"
Reason Given: Unable to open this mailbox.

The error usually occurs when there is inbox.lock file in the mailbox.
Here the inbox gets locked and hence the mailbox can't be accessed and
you will get the above said error.

1. Remove the "inbox.lock" file from the particular mailbox.

Eventhough the "inbox.lock" file is deleted, it will be created when
the mailbox is accessed again. Hence after removing the file, we need
to copy the inbox to a new file name so as to fix the issue which can
be done as follows,
2. cat inbox > inbox.new
3. rm inbox
4. mv inbox.new inbox
5. Then fix ownership and permissions.

This fixes the issue.

Enjoy:)

Spamd Failing

If you find the "spamd" failing error on an exim restart.

root@server [~]# /etc/init.d/exim restart

Shutting down exim: [ OK ]

Shutting down antirelayd: [ OK ]

Shutting down spamd: [ FAILED ]

Starting exim-26: [ OK ]

Starting exim: [ OK ]

Starting exim-smtps: [ OK ]

Starting antirelayd: [ OK ]

Then use he following steps

When disabling "spamd", the Cpanel create a file named "/etc/spamdisable" which may not get deleted on enabling the "spamd" feature again. Check the presence of the above said file.

The issue may also arise due to unavailability of the perl module "Mail::SpamAssassin" by installing the the same and on restarting the exim, the issue will be fixed.

# /scripts/perlinstaller --force Mail::SpamAssassin

#/etc/init.d/exim restart

Enjoy:)


The recipient cannot be verified. Please check all recipients of this 550 message to verify they are valid

If you are receiving the following error;

PERM_FAILURE: SMTP Error (state 13): 550-"The recipient cannot be verified. Please check all recipients of this
550 message to verify they are valid."

SOLUTION:

First you need to check the corresponding Domain name in the file '/etc/valiases'.

root@f ~] cat /etc/valiases/domainname
*: username@domainname

Here 'username@domainname' indicates an added email account.

You need to change the username only instead of giving 'username@domainname'. That is;

root@f ~] cat /etc/valiases/domainname
*: username

Here the entry username (without the domain name) indicates the default account.

Then Restart the exim mail service.

root@f ~] /etc/init.d/exim restart

Enjoy:)

Configure exim to listen on additional ports.

Exim is a popular Message Transfer Agent (MTA) used on Unix systems. By default Exim will be listening on port 25. To make Exim listening on other additional port, say 26, add the following line to /etc/exim.conf.

daemon_smtp_ports = 25:198:200

After this restart Exim using the following commands.

service exim restart

or
/etc/init.d/exim restart

This will make Exim to listen on ports 25 as well as 26.

Enjoy:)

Mail Error message: Error 550 – “The recipient cannot be verified”:

On servers running cPanel, some times it is found that mail sent to valid users is bounced back by the mail server.
The bounce back messages will be similar to the following.

-----------------------
PERM_FAILURE: SMTP Error (state 9): 550-"The recipient cannot be verified.
Please check all recipients of this550 message to verify they are valid.

-----------------------

If the email account does indeed exist, then it is need to run the following commands to correct the issue.

/scripts/updateuserdomains
/scripts/mailperm


Also check the /etc/localdomains file and verify that the domain name is present. Also verify that the DNS line in the
/var/cpanel/user/username contains the domain as well.

Enjoy:)

Configuring a Cpanel Counter

A counter counts the number of visitors on your site. If you refresh the page counter will get increased by one.

Follow the steps given below to configure a Cpanel counter.

1. Go to counter option in your cpanel. Cpanel >> CGI center >> counters.
2. Click on counter radio button.
3. Edit/Reset a counter
Counter name:-> generally it is account username. It creates file with .dat extension on server.
New Count:-> Enter number from where you want to setup counter generally start from 0.
If you want to reset counter you have to edit both features and click on “select commit changes”. You are also able to view
counters preview through option preview.
4. Click on 'Make HTML', this will display a line.
5. On server go to following path
# cd /var/cpanel/Counters
Check file is created with the name countername.dat. Changes file permission to 777.
6. # vi countername.dat
Add the line which is created by clicking 'Make HTML' in cpanel to countername.dat file.

Enjoy:)

Enable quota in the server

If quotas are not enabled for the partition, the following error will occur while doing a quotacheck in the server. In case of Cpanel server, /scripts/initquotas will throw the following error.

/scripts/initquotas
Quotas are now on
Updating Quota Files......
quotacheck: Can't find filesystem to check or filesystem not mounted with quota option.
quotacheck: Can't find filesystem to check or filesystem not mounted with quota option.
....Done

You need to follow the steps given below:

$ touch /quota.user /quota.group
$ chmod 600 /quota.*
$ mount -o remount /
$ quotaoff -a
$ vi /etc/fstab
( open 'fstab' file and add usrquota,grpquota to the partition where you want to have quota on. That is, for example, add the entry like:
/dev/ubd0 / ext3 defaults,noatime,usrquota,grpquota 1 0 )
$ quotaon -a

Then you can execute the script successfully without any errors. You can run a quotacheck in the server. In Cpanel server, you can run
initquotas without any errors.
Enjoy:)

Round Cube Installation

Remove the previous traces of Roundcube in the server.

====================
cd /usr/local/cpanel/base
rm -rf roundcube*
mysql
mysql>drop database roundcube;
====================

Before starting the installation, you need to know the root password of Mysql

====================
cd /usr/local/cpanel/base
wget http://easynews.dl.sourceforge.net/sourceforge/roundcubemail/roundcubemail-0.1beta2.1.tar.gz
tar -zxvf roundcubemail-0.1beta2.1.tar.gz
mv -f roundcubemail-0.1beta2 roundcube
cd roundcube
chmod -R 777 temp
chmod -R 777 logs
====================

Create the database. Find mysql root password from /root/.my.cnf.
Login as user, root.

====================
mysql -u root -p
Password:
mysql>CREATE DATABASE roundcube;
mysql>use roundcube;
mysql>source SQL/mysql.initial.sql;
mysql>quit
====================


Add the configuration:

====================
cd config
mv db.inc.php.dist db.inc.php
mv main.inc.php.dist main.inc.php
====================

Edit the configuration files

====================
using your text editor edit db.inc.php

Find:
$rcmail_config[’db_dsnw’] = ‘mysql://roundcube:pass@localhost/roundcubemail’;
Replace with:
$rcmail_config[’db_dsnw’] = ‘mysql://root:rootpass@localhost/roundcube’;
#vi main.inc.php
====================

Replace the corresponding root password

====================
Find:
$rcmail_config[’default_host’] = ”;
Replace with:
$rcmail_config[’default_host’] = ‘localhost’;
====================

Configure cPanel to show roundcube in the theme. X theme(default) only!!

====================
cd /usr/local/cpanel/base/roundcube/skins/default/images/
cp roundcube_logo.png /usr/local/cpanel/base/frontend/x/images/roundcube_logo.png
cp roundcube_logo.png /usr/local/cpanel/base/webmail/x/images/roundcube_logo.png
wget http://www.yourserverguide.com/Files/HGpatch-roundcube-1.0BETA2.1
patch -p0 <>
====================

If you receive a message stating: Reversed (or previously applied) patch detected! Assume -R? Please press N for No as this is because you previously installed roundcube

This will auto do all the necessary changes to roundcube and the X theme. Once the patch is executed you may now access roundcube via http://yourdomain/webmail

Enjoy:)

Rvsitebuilder installation in Cpanel

1. If the server has RVSkin installed, update RVSkin to v6.75 up. (Skip this step if you don't have it).

perl /root/rvadmin/auto_rvskin.pl

2. After getting the license confirmation, SSH to the cPanel server as root, download the installer using the command below:

cd /usr/local/cpanel/whostmgr/docroot/cgi/
rm -f rvsitebuilderinstaller.tar
wget http://download.rvglobalsoft.com/rvsitebuilderinstaller.tar
tar -xvf rvsitebuilderinstaller.tar
chmod 755 addon_rvsitebuilder.cgi


3. Open WHM as root user, at the bottom left menu under Plugins section, you can find RVSiteBuilder Installer menu.

4. Click RVSiteBuilder Installer to begin the installation process.

5. After complete the installation, you will be sent to RVSiteBuilder Manager automatically.

Enjoy:)

Upgrade Perl to 5.8.8 (Cpanel 11.4.2)

The cpanel 11 requires perl version 5.8.8. To upgrade the perl version in the server you can use following steps:-

1. Download perl 5.8.8 using following link:-

[root@serv ~]# wget http://layer1.cpanel.net/perl588installer.tar.gz

2. Untar the tar package using following command

[root@serv ~]# tar -vzxf perl588installer.tar.gz

3. Then Install

[root@serv ~]# cd perl588installer
[root@serv ~]# ./install

Once this has completed, execute the following to ensure that all modules
required by cPanel are installed, and restart cPanel:

[root@serv ~]# /usr/local/cpanel/bin/checkperlmodules
[root@serv ~]# /usr/local/cpanel/startup

4. Check and confirm the perl version using the command:

[root@serv ~]# perl -v

Enjoy:)

Creating a Ruby On Rails application in Cpanel

Ruby On Rails icon is there in cpanel theme from cpanel 11 onwards.
You can create a Ruby On Rails application in cpanel by following steps given below.

1. Login to cpanel
2. Click on the Ruby On Rails Icon in cpanel.
3. Fill in the "App Name" box with the application name you want to use.
4. Check the box for "Load on boot'.
5. Application Path will be automatically filled in as public_html/application_name.

You can create the application in this location itself. But, if you are installing this inside public_html, the configuration files will be public and everyone can access it. In order to avoid this, change the permission of the configuration files to 600. The main configuration file in which mysql passwords are stored is database.yml(Path: path_to_application/config/database.yml).

Or, you can install the application outside the public_html directory(in the home directory itself). Then you should set redirect to this application through apache to the mongrel port from the cpanel >> Ruby On rails>>Redirects. Mongrel is the default webserver for RoR applications, which will be installed in the server when we install ruby using using /scripts/installruby.

6. Select the environment. The default environment in which the application will be created is 'production'.

7. Click "Create".

Application will be created in the specified path. All the newly created application will be using a port(>12000).

If the application name is test and installation directory /home/username/public_html/test, then you can access the application using http://domainname/test/public/ (Use '/' at the end which is the good method).

Enjoy:)

disable the the stats services in a cpanel

You can disable Analog or Awstats or Webalizer stats in a cpanel server via backend by editing the file "/var/cpanel/cpanel.config".

# Check for the variables skipanalog, skipawstats, skipwebalizer in the file and change the values
of the variables to one. Now the variables should look like as follows:

skipanalog=1
skipawstats=1
skipwebalizer=1


# Save the changes and restart the cpanel service in the server.

/etc/init.d/cpanel restart

# Now the all the three stats will be disabled server wide.

Enjoy:)

Memcached + PHP Memcache Extension Installation

Reciently at work as well as in my own personal developement I have found a lot of emphasis on caching technologies. Be this for keeping heavy database queries to a minimum or because you wish to keep heavily served files out of the disk I/O. In this post (my first post!!) I will demonstrate how to install and configure memcached on a linux (CentOS to be specific) box. As well how to install the memcache extension into PHP.

Installing Memcached

Make sure before you start tying to install memcache that you have gcc (# yum install gcc) and libevent-devel (# yum install libevent-devel) installed.

[root@nitrogen ~]# wget http://www.danga.com/memcached/dist/memcached-1.2.6.tar.gz
[root@nitrogen ~]# tar -zxvf memcached-1.2.6.tar.gz
[root@nitrogen ~]# cd memcached-1.2.6
[root@nitrogen memcached-1.2.6]# ./configure
[root@nitrogen memcached-1.2.6]# make
[root@nitrogen memcached-1.2.6]# make install


Now if you are lazy like me and don’t want to have to remember what the memcached flags are every time you start it I would recommend using an init.d script. I recommend using the one located at http://www.dev411.com/wiki/Memcached_startup_files_for_Red_Hat_(RHEL). To install the init.d script on your server you need to place the start-memcached perl script in /usr/local/bin/start-memcached. Make sure you have given this file chmod 755 and is chown root:root. Then you must place the memcached-init into /etc/init.d/memcached, make sure this script has the same permissions as the previous file. Finally create the configuration file /etc/memcached.conf, you can place any options that you want ran by the memcached binary in this file. I use the following in my file.

# /etc/memcached.conf
# user to run memcached as
-u apache


# we want to run memcached as a daemon
-d

# amount of RAM we want to dedicate to memcached in MB
-m 512

# interface to listen to for memcached connections on
-l 127.0.0.1

# port to listen for memcached connections on
-p 11211
Starting Memcached

Now you should be able to start and stop memcached quickly by using the following commands.

[root@nitrogen ~]# /sbin/service memcached start
[root@nitrogen ~]# /sbin/service memcached stop

If you did not install the init.d script then you can start memcached with the following command.

[root@nitrogen ~]# memcached -d -u apache -m 512 -l 127.0.0.1 -p 11211

Installing the Memcache PHP extension

Installing the memcache php module from source is fairly strait forward, it is just like installing any other php module. Please note that you must have zlib-devel and php-devel packages installed.

[root@nitrogen ~]# wget http://pecl.php.net/get/memcache
[root@nitrogen ~]# tar -zxvf memcache-3.0.2.tgz
[root@nitrogen ~]# cd memcache-3.0.2
[root@nitrogen memcache-3.0.2]# phpize
[root@nitrogen memcache-3.0.2]# ./configure
[root@nitrogen memcache-3.0.2]# make
[root@nitrogen memcache-3.0.2]# make install


Now we need to tell php to include our memcache extension when it starts up.We do this by putting the following configuration data in /usr/local/lib/php.ini (or whatever the path is)

extension=memcache.so

You will be able to verify that the memcache php extension has been installed by typing #
php -m and looking for memcache in the php extension list.

Source link : http://www.wolflabs.org/2008/12/07/memcached-php-memcache-extension-installation/

E
njoy:)

Spamd child process causing high server load

Sometimes, spamd child process for a particular user can cause high server load. This is a bug with spamassassin :

To fix the issue, apply the patch mentioned in the bug.

For servers, run the following scripts:

/scripts/autorepair spamd_dbm_fix
/etc/init.d/ restart

Enjoy:)


squirrelmail problem (451 Temporary local problem)

Read this entire post before trying anything....


Try editing your /etc/localdomains to your liking. In mine, I included every actual and parked domain on the server, as well as the hostname for the server.

Then try removing the file /etc/remotedomains:

rm /etc/remotedomains

Then put an empty remotedomains back:

touch /etc/remotedomains


You should now have a good localdomains, and an empty remotedomains.

Try running /scripts/mailperm now... when I did this, it left the localdomains file alone. I'm guessing that the contents of the remotedomains file may have a bearing on the contents of the localdomains file.

Do this at your own risk, though... I don't know what other affects this could have. I just saw in the script that it looked at the remotedomains file. I also noticed there are two options available, neither of which I tried:

/scripts/mailperm --skiplocaldomains
/scripts/mailperm --skipserverperm

If you still get the same problem then do the following steps:


Uninstall the older,
rpm -e clamd-xxxxx
rpm -e clamav-devel-xxxxxxx
rpm -e clamav-0.xxxxxxxx
rpm -e clamav-db-xxxxxxxxxx

I got the clamav and clamd RPM from
http://3es.atomicrocketturtle.com/atomic/atomic/9/RPMS/

and Install the newer:

rpm -Uvh clamav-db-0.xxxxx
rpm -Uvh clamav-0.xxxx
rpm -Uvh clamd-0.xxxx
rpm -Uvh clamav-devel-0.xxxxx

This two lines is very important.

mv /usr/local/bin/clamdscan /usr/local/bin/clamdscan.orig
ln -s /usr/local/bin/clamscan /usr/local/bin/clamdscan

If this does not work try to do this:
mv /usr/bin/clamdscan /usr/local/bin/clamdscan.orig
ln -s /usr/bin/clamscan /usr/local/bin/clamdscan

Your issue should be FIX now.

Enjoy:)

Add IPs on plan server (No Control Panel)

Simply Follow the commands:

/sbin/ifconfig eth0:1 (X.X.IP.X)
/sbin/ifconfig eth0:2 (X.X.IP.X)

add the ips then bring up the interface by using following commands:

ifconfig eth0:1 (X.X.IP.X) netmask 255.0.0.0 up
ifconfig eth0:2 (X.X.IP.X) netmask 255.0.0.0 up

That's it

E
njoy:)

Adding Secondary IP's to Debian server

debian:~# cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
address 72.232.34.250
gateway 72.232.34.249
netmask 255.255.255.248


To add the other IP's to a Debian server edit the file add the IP'
the file will look like below :

nano -w /etc/network/interfaces

# The primary network interface
auto eth0
iface eth0 inet static
address 72.232.34.250
gateway 72.232.34.249
netmask 255.255.255.248


auto eth0:0
iface eth0:0 inet static
address 72.232.34.251
gateway 72.232.34.249
netmask 255.255.255.248

auto eth0:1
iface eth0:1 inet static
address 72.232.34.252
gateway 72.232.34.249
netmask 255.255.255.248

Enjoy:)

DirectAdmin Liicense Issue

Error says - Liicense expired
Solution:
Steps to try and resolve this problem.

Verify IP information bound to the host matches the data in

/usr/local/directadmin/scripts/setup.txt

Confirm the date is correct.
# date
Sun Jan 4 03:14:22 CST 2004

If not then set the date with 'rdate' or 'ntp'
# rdate -s time.nist.gov

Verify date is now correct.
# date
Thu Feb 3 17:44:23 CST 2005
Check and see if DA is now accessable.

If that does not work try the following.

cd /usr/local/directadmin/scripts
./getLicense.sh 123 1234
service directadmin restart

Where 123 and 1234 are your Client ID and License ID, respectively. If there are errrors extracting the update.tar.gz file, then run:
head -n 1 /usr/local/directadmin/conf/license.key

to search for an error. If there is an readable error inside the file, double check the IP you are using matches the IP in the license on our system. Also check that it's active in our clients section. Failing that, you'll need to contact support@layeredtech.com to get your license activated or updated.

./getLicense.sh 11461 36802

Enjoy:)

Scanning softwares - rkhunter,rootkit,

rkhunter:

Rootkit Hunter scanner: is scanning tool to ensure you for about 99.9%* you're clean of nasty tools. This tool scans for rootkits, backdoors and local exploits by running tests like:

MD5 hash compare
- Look for default files used by rootkits
- Wrong file permissions for binaries
- Look for suspected strings in LKM and KLD modules
- Look for hidden files
- Optional scan within plaintext and binary files

Rootkit Hunter is released as GPL licensed project and free for everyone to use.

* No, not really 99.9%.. It's just another security layer


Installing rkhunter

# wget http://jaist.dl.sourceforge.net/sourceforge/rkhunter/rkhunter-1.3.0.tar.gz
# tar xvzf rkhunter-1.3.0.tar.gz
# cd rkhunter-1.3.0
# ./install.sh --layout default --install
# rkhunter --propupd
# rkhunter --check

chkrootkit:

chkrootkit: shell script that checks system binaries for rootkit modification.

The following tests are made:
aliens asp bindshell lkm rexedcs sniffer wted w55808 scalper slapper z2 amd basename biff chfn chsh cron date du dirname echo egrep env find fingerd gpm grep hdparm su ifconfig inetd inetdconf init identd killall ldsopreload login ls lsof mail mingetty netstat named passwd pidof pop2 pop3 ps pstree rpcinfo rlogind rshd slogin sendmail sshd syslogd tar tcpd tcpdump top telnetd timed traceroute vdir w write


Installing CHKROOTKIT

1. Login to your server as root. (SSH)

2. Down load the chkrootkit.
Type: wget ftp://ftp.pangeia.com.br/pub/seg/pac/chkrootkit.tar.gz

3. Unpack the chkrootkit you just downloaded.
Type: tar xvzf chkrootkit.tar.gz

4. Change to new directory
Type: cd chkrootkit*

5. Compile chkrootkit
Type: make sense

6. Run chkrootkit
Type: ./chkrootkit

If it says "Checking `bindshell'... INFECTED (PORTS: 465)"This is normal and it is NOT really a virus.

Enjoy:)



Enable mod_rewrite

  1. Find the httpd.conf file (usually you will find it in a folder called conf, config or something along those lines)
  2. Inside the httpd.conf find uncomment line LoadModule rewrite_module modules/mod_rewrite.so (remove the pound '#' sign from in front of the line)
  3. Also find the line ClearModuleList is uncommented then find and make sure that the line AddModule mod_rewrite.c is not commented out.

Check to see if mod_rewrite is enabled

There are several ways to check if its working, I will try to show you the simplest method, Create a .htaccess file (a text file named .htaccess) with the following code in it

Options +FollowSymLinks
RewriteEngine On

Save the file to a subdirectory of your main site something like this

/rewrite-testfolder/.htaccess

Now attempt to browse to the subdirectory (http://localhost/rewrite-testfolder/). One of two things could happen

- No errors Congrats mod_rewrite engine is now enabled.

- 500, Internal Server Error If you get this message then mod_rewrite was not installed/enabled on your computer.


Enjoy:)



Step by step installation - Eaccelerator

Eaccelerator is a PHP accelerator/encoder/caching utility that is based off of the old mmcache (which is no longer being maintained). What Eaccelerator does is it caches your PHP scripts so that the database is no longer being queried everytime someone needs a script. This is
particularly useful for large forums, but pretty much anyone can benefit from it. Since these scripts are cached, you’ll notice a decrease in memory use and server load.

Install instructions:
1.Login as root
2.Download Eaccelerator
Lets get the source file first.
wget http://bart.eaccelerator.net/source/0.9.5.2/eaccelerator-0.9.5.2.zip
Extract and move into the directory
unzip eaccelerator-0.9.5.2.zip
cd eaccelerator-0.9.5.2"

Note:
# need to find where PHP is installed. For most, it’s usually either “/usr/bin” or “/usr/local”, but it may be something else. you can find using "which php" command.

Create configuration files

phpize

# If you are getting phpize: command not found , Then you need to install php-devel.

yum install php-devel

and then follow the steps

phpize
./configure –enable-eaccelerator=shared –with-php-config=/usr/bin/php-config
make
make install

Take note of where the shared lib was installed (last line of output of the the above command)

cp eaccelerator.ini /etc/php.d

Edit the above (copied) file, locate this line:
zend_extension_ts=”/usr/lib/php4/eaccelerator.so”

and replace it with ( whatever path you have noted )

zend_extension=”/usr/lib/php/modules/eaccelerator.so”

Now all that’s left is to create a tmp dir for eaccelerator’s cache (/tmp/eaccelerator is the default, but you can change it in the above file), and restart apache.

mkdir /tmp/eaccelerator
chown apache /tmp/eaccelerator
chgrp apache /tmp/eaccelerator
chmod 644 /tmp/eaccelerator
/sbin/service httpd restart

Test by knocking up a phpinfo.php page or give php -v command via shell you should note.

********

PHP 5.0.4 (cli) (built: Nov 8 2005 08:27:12)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v2.0.4-dev, Copyright (c) 1998-2004 Zend Technologies
with eAccelerator v0.9.5.3, Copyright (c) 2004-2006 eAccelerator, by eAccelerator

********

Enjoy:)


Upgrade PHP to 5.2.x Using Yum

To upgrade to PHP 5.2.x on CentOS/RHEL/:

Step 1) Set up the atomic channel:

wget -q -O - http://www.atomicorp.com/installers/atomic.sh | sh

Step 2) Upgrade to PHP 5.2.x:

yum update

Step 3) Replace the PHP 4 php.ini with PHP 5.2.x’s (if applicable):

mv /etc/php.ini.rpmnew /etc/php.ini

Step 4) Replace the php.conf with the PHP 5.2.x php.conf (if applicable):

mv /etc/httpd/conf.d/php.conf.rpmnew /etc/httpd/conf.d/php.conf

Step 5) Restart the webserver

service httpd restart

Enjoy:)

How to upgrade Apache version to 2.0.61 on plesk server ?

Here are the steps >>

1. Make a copy of your current httpd.conf incase you need to roll-back
cp /usr/local/apache/conf/httpd.conf /usr/local/apache/conf/httpd.conf_back

2. Download The Apache Tar.Gz File

wget http://www.apache.org/dist/httpd/httpd-2.0.61.tar.gz

3.Extract The File To Your Server

tar -zxvf httpd-2.0.61.tar.gz

4.Move Into The Extracted Folder
cd httpd

5. If you want the default apache configuration then run the Configuration File i.e

./configure


Note : but if you want your current updated apache configuration then make sure to create the phpinfo.php file and copy the available Configure Command as it is and run the full command instead of ./configure

6.Run The Make File
make

7.Run The Install Make File
make install

Start Apache
/etc/init.d/httpd restart

and thats done!!

Enjoy:)

Ioncube Installation On Linux Plesk Server

1) Download the tar.gz file which is compatible with your server from “http://downloads.ioncube.com/”
wget http://downloads2.ioncube.com/loader…lin_x86.tar.gz

2) Untar the downloaded file.
tar -zxf ioncube_loaders_lin_x86.tar.gz

3) Move the untared file to /usr/lib/php/modules
mv ioncube /usr/lib/php/modules

4) chown -R root:root /usr/lib/php/modules/ioncube

5) vi /etc/php.ini
Add the following line before any other zend_extension

Quote:

zend_extension=/usr/lib/php/modules/ioncube/ioncube_loader_lin_5.1.so

It would go between these two entries

Quote:

zend_optimizer.version=3.3.0
zend_extension=/usr/local/Zend/lib/ZendExtensionManager.so

Save changes, then:
6) /etc/init.d/httpd restart

Now Ioncube Installed on the server, verified output

Quote:

[root@VPS server ~]# php -v
PHP 5.1.6 (cli) (built: Sep 20 2007 10:16:10)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
with the ionCube PHP Loader v3.1.32, Copyright (c) 2002-2007, by ionCube Ltd., and
with Zend Extension Manager v1.2.2, Copyright (c) 2003-2007, by Zend Technologies
with Zend Optimizer v3.3.0, Copyright (c) 1998-2007, by Zend Technologies

Enjoy:)

How to run PHP 4 and 5 on Cpanel

This information is helpful for hosting companies that want to run PHP 4 & 5 on the same cPanel server. After this, Hosting costumers / cPanel users should choose what version of PHP will they use on theirs scripts.

You should consider some implications on your server performance, but webhosts are using because they don't need two server to run the different PHP versions for different costumers.

How to run PHP 4 and 5 on the same Cpanel server

1. Login to you cPanel server as root using ssh

2. Check the compiler and remove and re-create cpphpbuild directory

# /scripts/checkccompiler
# rm -rf /home/cpphpbuild
# mkdir /home/cpphpbuild
# cd /home/cpphpbuild

3. Download PHP5 and extract it

# wget http://us2.php.net/get/php-5.2.4.tar.gz/from/this/mirror
# tar zfx php-5.2.4.tar.gz
# cd php-5.2.4

4. Download, build and install php5.gen.cpanel
echo “#define HAVE_SENDMAIL 1″ >> /home/cpphpbuild/php-5.2.4/main/php_config.h
# wget http://www.elix.us/tutorials/php5.gen.cpanel
# chmod 700 php5.gen.cpanel
# ./php5.gen.cpanel
# make

If you get following error:
Got this error:
gcc: /usr/lib/mysql/libmysqlclient.so: No such file or directory
make: *** [sapi/cgi/php-cgi] Error 1

Then try this:
# cd /usr/lib

cp libmysqlclient.* /usr/lib/mysql/

And then try again #make

# make install

5. Now you should move the files and finish the configuration

# cp -f /usr/local/php5/bin/php5 /usr/local/cpanel/cgi-sys/php5
# chown root:wheel /usr/local/cpanel/cgi-sys/php5 # cp -p /home/cpphpbuild/php-5.2.4/php.ini-recommended /usr/local/php5/lib/php.ini
# chown root.root /usr/local/php5/lib/php.ini
# chmod 644 /usr/local/php5/lib/php.ini
# echo “cgi.fix_pathinfo = 1 ; needed for CGI/FastCGI mode” >> /usr/local/php5/lib/php.ini

Configure httpd.conf file, save and exit.

# nano /usr/local/apache/conf/httpd.conf

Scroll down (better use the built-in search) to the ""
There we should to add index.php5 after index.jp, but before index.php4. Result would looks like this:

DirectoryIndex index.html index.wml index.cgi index.shtml index.jsp index.js index.jp index.php5 iindex.php4 index.php3 index.php index.phtml ndex.htm default.htm default.html home.htm

This to allow index.php5 as index file.
Continue editing. Find the "AddType application/x-httpd-php .phtml" and after it add this:

Action application/x-httpd-php5 "/cgi-sys/php5"
AddHandler application/x-httpd-php5 .php5


This is the directives for Apache to use own php5 for files with extensions .php5

Check if we could find this line "ScriptAlias /cgi-sys/ /usr/local/cpanel/cgi-sys/"
If not - add it or our directive will not work. By default cPanel add this line. Just to warn you.

Save the file and quit.

Verify that you not broke the Apache config by running:

service httpd configtest


You SHOULD to get "Syntax OK" at the end and possible some minor warnings about "NameVirtualHost directive" - it is OK.
Warning: if you get ERROR - DO NOT RESTART APACHE AND LOCATE THE ISSUE. Otherwise Apache will not start at all!

When you make sure it is OK restart the Apache:

service httpd stop
service httpd startssl

Check that Apache come ok:

lynx --dump http://localhost/whm-server-status;

It will show you the Apache status.

Well, I should congratulate you - you have done it!

Now create php files with the name "phpinfo.php" and "phpinfo.php5" and add the following code to the file



If you have done successfully, both files should show proper version.


Enjoy:)

Delete emails from mail queue by using qmHandle (Plesk+Linux)

When the mail queue on a dedicated , shared or virtual server has messages stuck in it, qmHandle can be a very handy tool.

First you can check the status of mail queue by using following command:

/var/qmail/bin/qmail-qstat

Download qmHandle from SourceForge. You actually only need the script ‘qmHandle’ so use that if you have it handy. Upload it to the server and untar it if necessary. You may download it from SourceForge using the following command;

wget http://mesh.dl.sourceforge.net/sourceforge/qmhandle/qmhandle-1.2.0.tar.gz

Untar it by using;

tar -xvzf qmhandle-1.2.0.tar.gz

First it is recommended to shutdown qmail to prevent possible corruption of the mail queue;

service qmail stop

qmHandle can show it’s own options;

./qmHandle
qmHandle v1.2.0
Copyright 1998-2003 Michele Beltrame

*************************

Available parameters:
-a : try to send queued messages now (qmail must be running)
-l : list message queues
-L : list local message queue
-R : list remote message queue
-s : show some statistics
-mN : display message number N
-dN : delete message number N
-Stext : delete all messages that have/contain text as Subject
-D : delete all messages in the queue (local and remote)
-V : print program versionAdditional (optional) parameters:
-c : display colored output
-N : list message numbers only(to be used either with -l, -L or -R)
You can view/delete multiple message i.e. -d123 -v456 -d567

*************************

to see some basic statistics

./qmHandle -s

to delete entire mail queue

./qmHandle -D

to force queue to send all queued messages. For this you will need qmail running.

./qmHandle -a

Make sure once you are done with Qmhandle to start your qmail back up by using;

server qmail start


Enjoy:)





WebDisk errors

error message saying make sure (Ports 2077 & 2078 are not Firewalled.)


You need enable Ports on local windows machine -

You can locate the Windows Firewall by going to "Control Panel -> Windows Firewall"

Double click on the "Windows Firewall" & click the tab "Exceptions"

Now click "Add Port" & insert webdisk as the Name and "2077" as the port.

Repeat the previous step this time change the name to webdisk SSL & add the port 2078.
============================================================

Also make sure you enable ports on server fire wall of site hosted.

Enjoy:)

Starting Mailman on CPanel Servers

root@xxx [~]# /usr/local/cpanel/3rdparty/mailman/bin/mailmanctl start
Starting Mailman's master qrunner.
root@xxx [~]# pgrep mailman
30193

Make sure that Mailman is enabled in CPanel Tweak Settings Wink.

How to fix this error in Mailing list
=======================================
We\'re sorry, we hit a bug!
Please inform the webmaster for this site of this problem. Printing of
traceback and other system information has been explicitly inhibited, but the
webmaster can find this information in the Mailman error logs.
Bug in Mailman version 2.1.9.cp2
=======================================
If you are the server administrator, proceed with the following steps:

1. Go to /usr/local/cpanel/3rdparty/mailman
cd /usr/local/cpanel/3rdparty/mailman

2. ls -al

3. chmod -R 2775 ./*

Check if this has fixed the issue.
If not run the fixmailman script.

4. /scripts/fixmailman


Enjoy:)







Unable to create newlist2 mailing list.

Getting following errors while creating mailing list.

Mailing List Created
The mailing list test on domain.com with password test was successfully created.

Unable to create test mailing list.


Just run /scripts/reinstallmailman

Sometimes , you may get the following error on cpanel error log while creating mailing list.

File “/usr/local/cpanel/3rdparty/mailman/bin/mailmanctl”, line 104, in ?
import paths

ImportError: No module named korean

Then try it:

uname -i

then do accordingly

yum install python-devel.i386

yum install python-devel.x86_64

/scripts/reinstallmailman

This should fix your issue.

Enjoy:)

Cpanel "Scripts" Usage

#Install Zend Optimizer

/scripts/installzendopt

# Hostname A Entry Missing! /scripts/fixndc then restart bind and apache

# Install Cron on New Server

/scripts/installrpm anacron vixie-cron ; /etc/rc.d/init.d/crond start

# Bandwidth issues

/scripts/cleanbw

# To fix problem in webalizer that stop updating stats
/scripts/fixwebalizer

/scripts/fixcommonproblems
/scripts/fixeverything
# Fixing Mail List MailMan

/usr/local/cpanel/bin/convertmailman2
#Reinstall MailMan

/scripts/reinstallmailman
#Fix Permissions on accounts:

/scripts/fixhome
# Edit mySQL conf file:

nano /etc/my.cnf
# Edit php.ini:

nano /usr/local/lib/php.ini (Default Path)
Edit Apache Conf:

nano /etc/httpd/conf/httpd.conf
# Checking Real Time Top Processes Login to SSH and run:

top
# Run cpanel backup

/scripts/cpbackup
# To try and fix domain controller:

/scripts/fixndc

# Quotas

/scripts/initquotas - takes a while to run
/scripts/resetquotas
/scripts/fixquotas - takes a while to run

#Add a Dns Entry

/scripts/adddns
#Install Frontpage Mail Exts

/scripts/addfpmail
# Add JavaServlets to an account (jsp plugin required)

/scripts/addservlets
# Add a User

/scripts/adduser
# Run WHM Lite

/scripts/admin
# Add Rlimits (cpu and mem limits) to apache.

/scripts/apachelimits
# Resync with a master DNS Server

/scripts/dnstransfer
# Edit A User’s Quota

/scripts/editquota
# Search For Trojans in /dev

/scripts/finddev
# Locate Trojan Horses

/scripts/findtrojans

Suggest Usage
/scripts/findtrojans > /var/log/trojans
/scripts/fixtrojans /var/log/trojans
/scripts/fixcartwithsuexec Make Interchange work with suexec
/scripts/fixinterchange Fix Most Problems with Interchange
/scripts/fixtrojans Run on a trojans horse file created by findtrojans to remove them

# Run this if a user’s stats stop working

/scripts/fixwebalizer
# Fix a broken valias file

/scripts/fixvaliases
# Turn on DMA and 32bit IDE hard drive access (once per boot)

/scripts/hdparamify
# Re-scan quotas. Usually fixes Disk space display problems

/scripts/initquotas
# Turn on SUEXEC (probably a bad idea)

/scripts/initsuexec
# Fetch + Install Zend Optimizer

/scripts/installzendopt
# Display Ipusage Report

/scripts/ipusage
# Terminate an Account

/scripts/killacct
# Delete “Security Problem Infested RPMS”

/scripts/killbadrpms
# Fix Various Mail Permission Problems

/scripts/mailperm
# Attempt to Troubleshoot a Mail Problem

/scripts/mailtroubleshoot
# Change a Mysql Password

/scripts/mysqlpasswd
# Kill Potential Security Problem Services

/scripts/quicksecure
# Rebuild Ip Address Pool

/scripts/rebuildippool
# Delete Nasty SSL entry in apache default httpd.conf

/scripts/remdefssl
# Restart a Service (valid services: httpd,proftpd,exim,sshd,cppop,bind,mysql)

/scripts/restartsrv
# Syncup Security Updates from RedHat/Mandrake

/scripts/rpmup
# Force a webalizer/analog update.

/scripts/runlogsnow
# Remove non-important suid binaries

/scripts/secureit
# Install Frontpage 4+ on an account.

/scripts/setupfp4
# Return a Simple process list. Useful for finding where cgi scripts are running from.

/scripts/simpleps
# Suspend an account

/scripts/suspendacct
# Syncup Cpanel RPM Updates

/scripts/sysup
# Unblock an IP

/scripts/unblockip
# UnSuspend an account

/scripts/unsuspendacct
# Update Cpanel

/scripts/upcp
# Update /scripts

/scripts/updatenow
# Create a New Account

/scripts/wwwacct

# account username for awstats to run manually

/scripts/runweblogs

Sometimes such behavior of apache/httpd (taking more and more memory until it dies or crashes the server) can be caused by corrupted MySQL database. Try to do the following:
1) Kill the mysql server
/etc/rc.d/init.d/mysql stop

2) Repair all SQL databases:
myisamchk -r /var/lib/mysql/*/*.MYI

3) Start mysql again:
/etc/rc.d/init.d/mysql start

Enjoy:)

Testing PHP-MySQL connection

Edit

dbHost = IP address of the remote database server.
dbname= give the database name
dbuser= database user
dbPass= the password of the user.

Access this script via browser and check whether the user is able to connect.

$dbHost = " ";
$dbName = " ";
$dbUser = " ";
$dbPass =
$dbType = "mysql";
mysql_connect($dbHost, $dbUser, $dbPass) or die("could not connect ".mysql_error());
mysql_select_db($dbName) or die("could not select db ".mysql_error());
echo "db selected";
?>


Enjoy:)

MySQL Socket Error in phpMyAdmin

While accessing phpMyAdmin, you may get the following error.

-----------------------------------------------------------------------------------------
#2002 - The server is not responding (or the local MySQL server's socket is not correctly configured)
-----------------------------------------------------------------------------------------

This is due to the missing socket file in the location /tmp.

The socket path which is specified in the phpMyAdmin configuration file is /tmp/mysql.sock.

$ vi /usr/local/cpanel/base/3rdparty/phpMyAdmin/config.inc.php
cfg['Server']['socket'] = '/tmp/mysql.sock';


If mysql.sock is missing in /tmp, then create a link to the mysql.sock file in /var/lib/mysql.

$ ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock

There is also another fix for this issue.

1. Open the phpMyadmin config file "config.inc.php".
-------------------------------------------------------------
vi /usr/local/cpanel/base/3rdparty/phpMyAdmin/config.inc.php
-------------------------------------------------------------

2.Locate the line:
---------------------------------------------------
$cfg['Servers'][$i]['host'] = 'localhost';
---------------------------------------------------

3.Replace 'localhost' with '127.0.0.1' and save.
---------------------------------------------------
$cfg['Servers'][$i]['host'] = '127.0.0.1';
---------------------------------------------------

This will also fix the issue.

Enjoy:)

Wrong disk usage on DirectAdmin Panel

DirectAdmin panel is showing wrong disk usage. In such cases we need to update the disk usage manually. Run the following command in the server to update the disk usage.

[root@test]# echo "action=tally&value=all" >> /usr/local/directadmin/data/task.queue



We can verify the disk usage shown in the directAdmin panel is correct
or not as the directAdmin will list the quota information based on the
output of the following command.

[root@test]#/usr/sbin/repquota -a

Enjoy:)

Installing Horde in Direct Admin

You can use the following steps to install Horde in a Direct Admin server.

1. First check whether IMAP module is enabled in PHP, if not recompile PHP with IMAP support.

$ vi /usr/local/directadmin/custombuild/configure/ap2/configure.php5

Add the following entries.
--with-imap=/usr/local --with-imap-ssl

$ /usr/local/directadmin/custombuild/build php n

If you are doing the installation in a VPS, sometimes you might get the following error:

configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing. This should not happen. Check config.log for additional information.

To fix this error install the libc-client-devel package

$ yum -y install libc-client-devel.i386 rpm

Now download the horde install script for DirectAdmin and install it.

$ wget http://www.fusion-ict.nl/da_plugin/horde_install.tar.gz
$ tar -zxvf horde_install.tar.gz
$ sh horde_install/horde_install.sh

This will install Horde in the server. Now you can access the Horde webmail using the URL http://domain.com/horde

If you get the following error when accessing Horde through browser,

A fatal error has occured DB Error: connection failed PASSWORD:


then do the following:

$ mysql
mysql > grant all privileges on da_horde.* to da_horde@localhost identified by "PASSWORD";
mysql > flush privileges;
mysql >\q


3. If you would like to access the Horde using the URL http://webmail.domain.com/ do the following :

First add an A record for webmail.domain.com. Then add the following VirtualHost entry in the /etc/httpd/conf/extra/httpd-vhosts.conf file and restart httpd service.

$ vi /etc/httpd/conf/extra/httpd-vhosts.conf


IP2:80>

ServerName webmail

ServerAlias webmail.*

DocumentRoot /var/www/html/horde



$ service httpd restart


Enjoy:)

To enable spamassassin for all existing accounts in Directadmin

To enable spamassassin for all existing accounts in Directadmin, create the following script and execute it.

Open a new file enablespam.sh

#!/bin/sh
for i in `ls /usr/local/directadmin/data/users`; do
{
username=$i spam=ON /usr/local/directadmin/scripts/custom/user_create_post.sh
};
done;
exit 0;

Chmod the file as 755 and execute it.

chmod 755 enablespam.sh

./enablespam.sh


Enjoy:)

How to upgrade apache in a directadmin server

For upgrading apache from 1.3.39 to Apache 2.0.63, just login to the server and run following commands/scripts.

#cd /usr/local/directadmin/customapache
#./build update
#./build clean
#./build update_data_ap2
#./build convert
#./build apache_2
#./build php_ap2 n
#./build mod_frontpage_ap2
#./build mod_perl_ap2

Enjoy:)

Recompiling apache/PHP in a directadmin server

To recompile apache/PHP on a directAdmin server. ( Like easyapache script in cPanel servers, there is no custom script, need to run the following commands manually ). This will be helpful, if current PHP/apache compilation in the server is broken and this can be found out from the error log (/var/log/httpd/error_log).
For updating apache run the following commands.

#cd /usr/local/directadmin/customapache

#./build clean

#./build update

#./build apache_mod_ssl

For building apache with PHP run the following commands.

#cd /usr/local/directadmin/customapache

#./build php y


Restart apache service.