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

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

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

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 )

Fatal error: Call to undefined function mysqli_query() error in Rayzz script

March 18th, 2008

Rayzz Script Error –

Fatal error: Call to undefined function mysqli_query()

This can be fixed by recompiling php with mysqli support or second option is –

pico common/config.inc.php

Locate line —

$CFG[’db’][’abstraction’] = ‘mysqli’;

Replace mysqli with mysql

Cpanel Account backup error

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

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

OSTube Installation Error.

December 9th, 2007

OSTube Installation Error : The command line version of PHP could not be found. Please make sure that the cli version is installed, and that mysql.so is also activated for the cli.

Solution :
This error is generally caused due to - OpenBase Dir Enabled.

Login to WHM >> Security Center –
PHP open_basedir Tweak >>

Click the check box in front of domain for which you wish to Exclude Protection.

Then Save it.

PHPMOTION - Fatal error: phpSHIELD Loader - script loader checksum error [17] Encoded script was modified in

December 9th, 2007

If you are getting an error with PHPshield or you are getting a “blank screen” read below.

This means you did not upload in Binary mode. The following files must be uploaded in binary

1) All files in the phpshiled folder

2) The file classes/config.php

If you FTP program has a function to set transfer mode, you should set to “binary” when you upload the files mentioned above. The main problem is that while you ftp program may correctly know that the files in the phpshield folder must be uploaded in binary, when it comes to the config.php file, because its a php file you ftp program will most likely upload it in ascii format. While this is ok for all other php files, config.php needs to be uploaded in binary.

Warning: dl() [function.dl]: Not supported in multithreaded Web servers

You need to turn off/disable Thread Safety this is done in your php.ini file on your server. If you dont have access to your server via SSH then ask your web host to do disable it for you.

extension_dir does not exists /usr/lib/php/extensions/no-debug-non-zts-200343.......

Your PHP was not setup correctly. There is a folder missing on your server. All you need to do is create a folder with the same given in your error message on your server. You will need SSH access to do this, or ask your host to do it. This directory ( Extensions directory) needs to actually exist on the server.


Warning: dl(): Dynamically loaded extensions aren't enabled

You need to set the value enable_dl On (i.e.enable_dl On ) in your php.ini file on your server. You need SSH access to change this file. If you don’t have such access, ask your web host to do it for you.

Any other errors you get mean that you are running your PHP in safe_mode On this needs to be set to safe_mode Off in your php.ini file

Warning: dl() has been disabled for security reasons in

The dl() function has been added to the list of disabled function on your server. You need to enable this (by removing it) in your php.ini file on the server.

BLANK SCREEN - when you load the setup or any other page

If you are getting a blank screen then you actually have any one of the problems above but your server is set to not show error notifications so you can see which error you are getting.

Solution:

The following files must be uploaded in binary

1) All files in the phpshiled folder

2) The file classes/config.php

The phpSHIELD loader has not been installed, or is not installed correctly

If you are getting this error and you know you have all the correct files uploaded etc, then you may want to check that your domain name is not setup on your server using capital letters.

Example: PhPMotion.com if this is how your domain name looks like in your control panel or on your server then you will get errors. Linux is case sensitive and domain names (hosting accounts) should not be created using capital letters. So delete the hosting account and recreate it with NO CAPS e.g. phpmotion.com

How to remove and uninstall or disable ModSecurity (mod_security)

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

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.

:)