Archive for the ‘WHM/cPanel’ Category

How to change default IP for Exim

Wednesday, July 29th, 2009

To configure exim to send mail using a different  IP other than the main shared IP.

vi /etc/exim.conf

Search for the following lines in /etc/exim.conf

remote_smtp:
driver = smtp

add the following line ,

interface = IPhere

and restart exim.

This would be helpful when your Main IP is blocked by RBL/CRL/AOL.

Unable to setup password protect directories if Frontpage Extenstion is enabled.

Tuesday, January 20th, 2009

Unable to setup password protect directories if Frontpage Extenstion is enabled.

As long as Front Page extensions are not installed on the domain,you can go to Apache in your service menu (in Cpanel) and click on the pencil (edit) icon for a rich set of administrative tools to manage password files and groups.If you are using Front Page to create your website, you will needto password protect directories using the available options in theFront Page software.

How to enable Innodb as default storage engine

Thursday, November 20th, 2008

How to enable Innodb as default storage engine ?

Solution :

Just edit your /etc/my.cnf file and look for this line:

skip-innodb

If such an entry exists, remove or comment out the entry

#skip-innodb

Next make the storage_engine variable to Innodb by adding following under [mysqld] section.

default-storage_engine = InnoDB
save the file, and restart mysql:

Restart mysql service

Apache – Address already in use: make_sock: could not bind to address

Tuesday, August 19th, 2008

This error message can be caused by an improper shut down, the apache processes are still hanging around and apachectl restart won’t work.

Solution

just kill off the hanging processes:
# fuser 80/tcp
80/tcp: 3010 3702 4088 16754
# kill -n 9 3010
# kill -n 9 3702
# kill -n 9 4088
# kill -n 9 16754
# apachectl start

or if there’s loads of processes use
# for i in $(fuser 80/tcp);do kill -n 9 $i;done
to kill them all off

Missing HOMEMATCH Config error while creating accounts.

Tuesday, May 13th, 2008

When creating or restoring a account i get the following error.

Missing HOMEMATCH Config Line in /etc/wwwacct.conf

Solution:

Steps to correct problem.
1. Log into the WHM as root (not a reseller)
2. Click ‘Basic cPanel/WHM Setup’
3. Scroll down to ‘Home Directory Prefix’, and put /home in the text-field.
4. Scroll down and click save

That’s it, now try to create or restore a account.

How to fix (rpmdb Lock table is out of available locker entries) error when trying to use RPM.

Tuesday, May 13th, 2008

If you are trying to use rpm or yum (which in turn calls RPM) and its showing a locker issues that looks something like this:

rpmdb: Lock table is out of available locker entries
error: db4 error(22) from db->close: Invalid argument
error: cannot open Packages index

or

rpmdb: Lock table is out of available locker entries
error: db4 error(22) from db->close: Invalid argument
error: cannot open Packages index using db3 – Cannot allocate memory (12)
error: cannot open Packages database in /var/lib/rpm

Solution :
Make a backup of /var/lib/rpm in case you break something:

tar cvzf rpmdb-backup.tar.gz /var/lib/rpm

Remove the Berkeley databases that rpm uses:

rm /var/lib/rpm/__db.00*

Make rpm rebuild the databases from scratch (may take a short while):

rpm –rebuilddb

Now, check rpm to make sure everything is okay:

rpm -qa | sort

Why does this happen?
When rpm accesses the Berkeley database files, it makes temporary locker entries within the tables while it searches for data. If you control-c your rpm processes often, this issue will occur much sooner because the locks are never cleared.

Clamd errors when exim is restarted

Thursday, April 24th, 2008

When exim is restarted clamd shows below errors:

bash-3.00# service exim restart
Shutting down clamd: [FAILED]
Shutting down exim: [ OK ]
Shutting down antirelayd: [ OK ]
Shutting down spamd: [ OK ]
Starting clamd: LibClamAV Error: cli_loaddb(): No supported database files
found in /usr/share/clamav
ERROR: Not supported data format [FAILED]
Starting exim-2626: [ OK ]
Starting exim: [ OK ]
Starting exim-smtps: [ OK ]
Starting antirelayd: [ OK ]
Starting spamd: [ OK ]
-bash-3.00#

And it doesn’t fix the issue if clamd is re-installed from WHM -> Plugins or via UPCP. It needs to be patched or re-installed as follows:

cd /usr/local/cpanel/mod*/clam*
./uninstall
./install

Install Imagemagick / Imagick for PHP on CentOS Cpanel/Plesk

Thursday, April 24th, 2008

Install Imagemagick / Imagick for PHP on CentOS Cpanel/Plesk

Solution : For installing Imagick extension for PHP you have to install ImageMagick from source and Its a Must. Otherwise the extension for PHP wont compile.

*# wget ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick.tar.gz*
# tar zxf ImageMagick.tar.gz
# cd ImageMagick-x.x.x
# ./configure
# make
# make install

Now download the Imagick extension source from http://pecl.php.net/package/imagick

*# wget http://pecl.php.net/get/imagick-x.x.x.tgz*
# tar zxf imagick-x.x.x.tgz
# cd imagick-x.x.x.tgz
# phpize && ./configure

*** if you get an error which looks like this:

============================
checking for PHP includes… -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext
checking for PHP extension directory… /usr/lib64/php/modules
checking for PHP installed headers prefix… /usr/include/php
checking for re2c… no
configure: WARNING: You will need re2c 0.9.11 or later if you want to regenerate PHP parsers.
checking for gawk… gawk
checking whether to enable the magickwand extension… no
configure: error: not found. Please provide a path to MagickWand-config or Wand-config program.
============================

Solution : Install ImageMagick-devel package using “yum install ImageMagick-devel” and then continue

# make
# make install

This will make compile imagick source and build imagick.so – In my machine, I found imagick.so in the following directory

Installing shared extensions: /path/to/php/modules/

# Now add “extension=imagick.so” in your php.ini (You may need to write the full path of imagick.so based on your configuration)

# Restart your web server and thats it (You should see the Imagick extension section in phpinfo page )

Cpanel Account backup error

Saturday, January 19th, 2008

Error while trying to take the backup of an account.(internal death while parsing ) Sat Jan 19 12:36:56 2008 [15888] error: Timeout: Alarm at bin/postgresadmin.pl line 40.
main::_ANON_(‘ALRM’) called at /usr/local/cpanel/Cpanel/PostgresAdmin.pm line 281
Cpanel::PostgresAdmin::listusers(‘Cpanel::PostgresAdmin=HASH(0x848441c)’) called at bin/postgresadmin.pl line 288

Timeout: Alarm at bin/postgresadmin.pl line 40.
Password: ………

Fix:
as root run
mv -f /var/lib/pgsql /var/lib/pgsql.old

then run
yes | /scripts/installpostgres

Don’t forget to do:

WHM-> SQL Services ->Postgres Config->Postgres Config Install

and then

WHM-> SQL Services ->Postgres Config->Postgres Password

How to Send Email from a PHP Script

Saturday, January 12th, 2008

Using php mail() function to send emails from php script.

Send Email from a PHP Script Example :

The first argument to this function is the recipient, the second specifies the message’s subject and the third one should contain the body. So to send a simple sample message, we could use:

$to = "recipient@example.com";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
if (mail($to, $subject, $body)) {
echo("

Message successfully sent!

“);
} else {
echo(“

Message delivery failed…

“);
}
?>

Save this file as mail.php and browse from url http://yourdomain/mail.php