Move domain between clients in Plesk

May 13th, 2008

Moving domains from client to client in Plesk is pretty quick from the command line. Just replace DOMAIN with the domain name you want to move and CLIENTLOGIN with the client’s username:

/usr/local/psa/bin/domain.sh --update DOMAIN -clogin CLIENTLOGIN

AWStats icons don’t appear in Plesk

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

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

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

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

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

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

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 \;

Missing HOMEMATCH Config error while creating accounts.

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.

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.