Archive for the ‘Plesk’ Category

AWStats icons don’t appear in Plesk

Tuesday, May 13th, 2008

The AWStats package in RHEL4/Centos4 and Plesk 8.1 uses an alias directory for the icons called /awstats-icon, but when the AWStats contents is generated, the icon directory is different (/icon). To fix this issue, change this file:

/usr/share/awstats/awstats_buildstaticpages.pl

my $DirIcons='/awstats-icon';

Can’t find file: ‘horde_sessionhandler.MYI’ in Plesk

Tuesday, May 13th, 2008

If you get this error, you’ve most likely done a file-based MySQL backup restore, and the InnoDB files are hosed. The horde_sessionhandler table isn’t a MyISAM table at all – it’s actually an InnoDB table. The easiest way to fix the issue is to stop MySQL and trash the .frm:

# /etc/init.d/mysqld stop
# rm /var/lib/mysql/horde/horde_sessionhandler.frm

Now start MySQL and re-create the table:

# /etc/init.d/mysqld start
# mysql -u admin -p`cat /etc/psa/.psa.shadow`

Here’s the SQL statements to run:

CREATE TABLE horde_sessionhandler (session_id VARCHAR(32) NOT NULL, session_lastmodified INT NOT NULL, session_data LONGBLOB, PRIMARY KEY (session_id)) ENGINE = InnoDB;
GRANT SELECT, INSERT, UPDATE, DELETE ON horde_sessionhandler TO horde@localhost;

You’re good to go!

Add SPF records to all domains in Plesk

Tuesday, May 13th, 2008

If you find yourself in the situation where you need to bulk add SPF records to every domain in Plesk, you can use this huge one-liner:

mysql -u admin -p`cat /etc/psa/.psa.shadow` psa -e “select dns_zone_id,displayHost from dns_recs GROUP BY dns_zone_id ORDER BY dns_zone_id ASC;” | awk ‘{print “INSERT INTO dns_recs (type,host,val,time_stamp,dns_zone_id,displayHost,displayVal) VALUES (‘\”TXT’\”,’\””$2″‘\”,’\”v=spf1 a mx ~all’\”,NOW(),”$1″,’\””$2″‘\”,’\”v=spf1 a mx ~all’\”);”}’ | mysql -u admin -p`cat /etc/psa/.psa.shadow` psa

Then you’ll need to make Plesk write these changes to the zone files:

# mysql -Ns -uadmin -p`cat /etc/psa/.psa.shadow` -D psa -e ‘select name from domains’ | awk ‘{print “/usr/local/psa/admin/sbin/dnsmng update ” $1 }’ | sh

You can check your work by viewing the new entries you made:

mysql -u admin -p`cat /etc/psa/.psa.shadow` psa -e “SELECT * FROM dns_recs WHERE type=’TXT’;”

Horde refreshes when logging in

Tuesday, May 13th, 2008

If you find that Horde (with Plesk) keeps refreshing when you attempt to log in, and there are no errors logged on the screen or in Apache’s logs, check the session.auto_start variable in /etc/php.ini.

If session.auto_start is set to 1, set it to 0 and Horde will miraculously start working again.

Remove all open_basedir restrictions in Plesk

Tuesday, May 13th, 2008

If you have an open_basedir restriction that is causing issues with a domain, you can remove the restriction easily. First, put the following text in /home/httpd/vhosts/[domain]/conf/vhost.conf:

<Directory /home/httpd/vhosts/[domain]/httpdocs>
php_admin_value open_basedir none
</Directory>

If there was already a vhost.conf in the directory, then just reload Apache. Otherwise, run the magic wand:

/usr/local/psa/admin/bin/websrvmng -av

Then reload Apache:

/etc/init.d/httpd reload

Plesk and PHPMyAdmin: Non-static method PMA_Config::isHttps() should not be called statically

Tuesday, May 13th, 2008

If this situation pops up in Plesk, it means that a user has changed their MySQL password outside of Plesk. The password in Plesk’s own database does not match, so the auto-creation of the phpMyAdmin settings fails. You’ll end up seeing this after clicking “DB WebAdmin”:

MySQL said: Non-static method PMA_Config::isHttps() should not be called statically

The funny thing is that MySQL doesn’t actually say this. It’s a PHP error. To correct the problem, you can manually change the password within Plesk’s database, or you can follow an easier method:

Click Databases
Click Database Users
Click the user that has a password change
In the password fields, enter the new password that they’re using with MySQL

This will force Plesk to change its password in its own database, and it will run the query to change the password in MySQL (but since it’s the same password, no change will be made).

mchk: Unable to initialize quota settings for someuser@somedomain.com

Tuesday, May 13th, 2008

If you’re working in Plesk and you receive this error:

mchk: Unable to initialize quota settings for someuser@somedomain.com

Run this command to fix the issue, but be patient:

find /var/qmail/mailnames -type d -name '.*' ! -name '.spamassassin' -ls -exec touch '{}'/maildirfolder \; -exec chown popuser:popuser '{}'/maildirfolder \;

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.

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 )

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