Archive for the ‘WHM/cPanel’ Category

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(0×848441c)’) 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

How to remove and uninstall or disable ModSecurity (mod_security)

Sunday, December 9th, 2007

ModSecurity is an open source embeddable web application firewall, or intrusion detection and prevention engine for web applications. ModSecurity provides protection from a range of attacks against web applications and allows for HTTP traffic monitoring and real-time analysis with no changes to existing infrastructure, by operating as an Apache Web server module mod_security or standalone, and thus increase web application security. However, mis configured or overly strict rule sets, ModSecurity may cause your website to return various errors such as HTTP 403 Forbidden error or access denied error, login problems, or HTTP 412 Precondition Failed error, or HTTP 406 Not Acceptable error and other false positive symptoms.

To make matter worse, the configuration of ModSecurity rules and filters have to be done manually. Although there are free predefined certified rule set which can be used with ModSecurity out of the box, however the rule sets may be not suitable for each and every environment and may interfere with the operation of websites or blogs, and customizing and modifying the rules may be too sophisticated or complicated for some users. And for some websites that hosted on shared hosting service, the mod_security may be enable by default without options. So in this case, the best solution or workaround for mod security related issues is to disable mod_security filtering and rules.

If you’re using Apache web server (which mostly do), mod_security can be disabled by adding a specific in .htaccess file. Locate the .htaccess file in Apache web root directory (public_html or /var/www/ or others), if it does not exist, create a new file named .htaccess, and add in the following code:

SecFilterEngine Off
SecFilterScanPOST Off

The above entries in the .htaccess will disable the ModSecurity (mod_security) module for the domain.

Uninstallation of ModSecurity (mod_security) from Apache module

The easiest way to remove and uninstall mod_security is to comment out or delete the related mod_security entries from httpd.conf Apache configuration file. The lines that should be removed include:

AddModule mod_security.c
LoadModule security_module modules/mod_security.so
Include “/usr/local/apache/conf/modsec.conf” This line may be different depending on what variant of Linux or Unix you used and the installation location

Save the httpd.conf and restart the Apache. ModSecurity will not be loaded and as if uninstalled.

If you’re using WebHost Manager (WHM), uninstallation is even simpler. Just scroll to cPanel section, and click on Addon Modules. Then scroll to module named modsecurity. It should be checked Install and Keep Updated currently. Just click on Uninstall to remove the mod security feature from Apache web server.

Taken from mydigitallife.info

mod_speling for cPanel - Case sensitive

Thursday, November 29th, 2007

The module’s source code was in:

/home/cpapachebuild/buildapache/apache_1.3.X/src/
modules/standard/

So now we use apxs to compile it and put it where we want (again, one long line):

/usr/local/apache/bin/apxs -c /home/cpapachebuild/buildapache/apache_1.3.X/src/
modules/standard/mod_speling.c -o /usr/local/apache/libexec/mod_speling.so

What that does is compile just the module source code and then places the compiled output in the “libexec” directory so apache can find it when it starts up.

Now edit your httpd.conf file, you must add these lines to the end of their respective sections (where other things like this are listed):

pico -w /etc/httpd/conf/httpd.conf

Add following lines -
LoadModule speling_module libexec/mod_speling.so

AddModule mod_speling.c

(save it then use the command below to check the conf file)

service httpd configtest

If that all works then you can try a httpd restart.

All that and no recompiling of apache! This is a interesting module, now you can type PiCtUrEs.html even though the actual file is pictures.html and it will still find the file.

Don’t forget to add “CheckSpelling On” into your .htaccess file in each site you want this to work in.

If that all works then you can try a httpd restart.

All that and no recompiling of apache! This is a interesting module, now you can type PiCtUrEs.html even though the actual file is pictures.html and it will still find the file.

Don’t forget to add “CheckSpelling On” into your .htaccess file in each site you want this to work in.

NOTE : For new EasyApache3 - mod_speling options is available during Apache/PHP compilation.

:)

SquirrelMail throwing ERROR: Could not complete request.

Tuesday, November 27th, 2007

ERROR: Could not complete request.
Query: CREATE “INBOX.Sent”
Reason Given: Cannot create this folder.

Solution : Mailbox is full - increase email quota or delete some emails from server.

Cheers..