Plesk: cannot remove email/domain/client: mailmng failed: Some errors occured

December 27, 2010    |   Posted by admin   |    Category: Plesk Management

If the mail handlers in Plesk are corrupt, you will be unable to remove the email account OR a domain from the Plesk control panel and will result in the following error

—————————————–

mailmng failed: Some errors occured. See log for details
0: class.MailManager.php:242
MailManager::execWithException(string ‘smart_exec’, string ‘mailmng’, array, array, string ‘lst’)
1: class.MailManager.php:274
MailManager->callMailManager(string ‘remove-mailname’, array)
2: class.MailManager.php:354
MailManager->removeMailname(string ‘domain.tld’, string ’emailid’)

—————————————–

The one of the following 3 methods can be used to resolve the issue:

1) To remove and re-create the mail handlers using the ‘mchk’ script and then deleting the email account from Plesk. For detailed steps, click here

2) To remove the email account via SSH.

# /usr/local/psa/bin/mail --remove email@domain.tld

3) If the above 2 methods doesn’t work, remove the email account from the Plesk database manually (backup the ‘psa’ database first). 

Let’s use the email ID as “xyz@abc.com” as an example here (of-course, it should be replaced with the actual values in your queries).

Connect to the psa database from SSH:

# mysql -uadmin -p`cat /etc/psa/.psa.shadow` psa

Retrieve the domain ID of abc.com

mysql> select id from domains where name="abc.com";

Now, first we will delete the password of the email account from the ‘accounts’ table by executing the below query:

mysql> delete from accounts where id in (select mail.id from \
mail INNER JOIN domains ON mail.dom_id=domains.id where \
domains.name="abc.com" AND mail.mail_name="xyz");

Now, delete the email name ‘xyz’ from the ‘mail’ table (replace ‘ID’ with the id retrieved from the first query)

mysql> delete from mail where dom_id='ID' AND mail_name='xyz';

Once done, restart the Mysql service and you will be able to remove the email account from the Plesk control panel.

How to install and configure APC Cache on a CentOS server?

December 18, 2010    |   Posted by admin   |    Category: Installations

APC cache is a PHP caching solution which stands for Alternative PHP Cache. It serves PHP pages from a cache thus helping to reduce server load. APC is an open source software and is updated from time to time.

The following are the steps to install APC cache on a cPanel / Plesk OR even on a plan CentOS server:

1) SSH to your server and go to a temporary directory

# cd /usr/local/src

2) Download the latest APC version

# wget http://pecl.php.net/get/APC-3.1.6.tgz

3) Unpack the version and change to the APC directory

# tar -zxf APC-3.1.6.tgz 
# cd APC-*

4) Create configuration files

# phpize

5) Search for the “php-config” file since you need to configure APC with it

# which php-config

6) Now, configure APC

# ./configure --enable-apc --enable-apc-mmap --with-apxs\
 --with-php-config=/usr/local/bin/php-config

7) Create the installation files and install APC

# make 
# make install

Now that the APC cache is installed on your server, the final step is to activate the APC extension in the php.ini file.

Locate the working php.ini file of your server

# php -i | grep php.ini

edit the file and search for “extension_dir” and place the following code below it (tweak the values as per your requirement):

extension="apc.so" 
apc.enabled=1 
apc.shm_segments=1 
apc.shm_size=256 
apc.ttl=3600 
apc.user_ttl=7200 
apc.num_files_hint=1024 
apc.mmap_file_mask=/tmp/apc.XXX 
apc.enable_cli=1

Restart the Apache web server  for changes to take affect. To confirm if APC is activated, execute

# php -i | grep apc

Note: once APC is installed, make sure the ‘apc.so’ file is created under the directory specified at the “extension_dir” in php.ini. If not, look for the exact path of the file and create a symlink under it.

List of path to various log files in Plesk

December 11, 2010    |   Posted by admin   |    Category: Plesk Management

Following is the list of path to different log files on a Plesk server.

Plesk Installation Logs:

/tmp/autoinstaller3.log


Plesk Upgrade Logs including other applications:

/tmp/psa-<app-name>...log


Plesk Access and Error Logs:

/usr/local/psa/admin/logs/httpsd_access_log 
/var/log/sw-cp-server/error_log


Plesk Migration Logs:

/usr/local/psa/PMM/logs/migration.log


WatchDog Logs on Plesk:

/usr/local/psa/var/modules/watchdog/log/monit.log


Apache Web Server Logs on Plesk:

/var/log/httpd/access_log 
/var/log/httpd/error_log


Apache Suexec Logs on Plesk:

/var/log/httpd/suexec_log


Access and Error Logs of a Website (account):

/var/www/vhosts/domain.tld/statistics/logs/access_log 
/var/www/vhosts/domain.tld/statistics/logs/error_log


Mysql Logs on Plesk:

/var/lib/mysql/server.hostname.err  (unless defined in /etc/my.cnf)


Named (Bind) Logs on Plesk:

/var/log/messages


Mail (Qmail and Postfix) Logs on Plesk:

/usr/local/psa/var/log/maillog


Ftp Logs on Plesk:

/var/log/messages


Server Logs on Plesk:

/var/log/messages


Horde Logs:

/var/log/psa-horde/psa-horde.log


Cronjob Logs:

/var/log/cron


SSH Logs:

/var/log/secure


Mailman Logs:

/var/log/mailman/


Tomcat Logs:

/var/log/tomcat5/catalina.out

Starting sshd: Missing privilege separation directory: /var/empty/sshd

December 5, 2010    |   Posted by admin   |    Category: Linux Administration

The SSHD service while restarting, looks for the “/var/empty/sshd/etc” directory which contains a symlink to the ‘localtime’ file. If the file doesn’t exist, it results in a “cannot create symbolic link `/var/empty/sshd/etc’: No such file or directory” error message.

The complete error message is as follows:

-bash-3.2# service sshd restart 
cp: cannot create symbolic link `/var/empty/sshd/etc': 
No such file or directory 
Starting sshd: Missing privilege separation: /var/empty/sshd [FAILED]

The solution is to create the “/var/empty/sshd/etc” directory and then create a symlink for localtime file.

# mkdir /var/empty/sshd/etc
# cd /var/empty/sshd/etc
# ln -s /etc/localtime localtime

Once done, you should be able to restart the sshd service.

How to add Domainkeys for a domain on a cPanel server?

November 29, 2010    |   Posted by admin   |    Category: cPanel Management

“DomainKeys” is an anti-spam software application that uses a public key, cryptography to authenticate the sender’s domain. cPanel offers a installer script “domain_keys_installer” using which the DomainKeys can be created and added automatically for a domain.

By default the DomainKeys is not added when the account is created on the server, it has to be added manually. SSH to your server and execute:

/usr/local/cpanel/bin/domain_keys_installer <username>

where, <username> is the username of the domain.

The DomainKey is automatically added in the DNS zone file of the domain located at /var/named/domainname.db file. To add DomainKeys for the existing domains, execute the following command as it is:

for i in `cat /etc/trueuserdomains | awk '{print $2}'`
do
/usr/local/cpanel/bin/domain_keys_installer $i;
done;

NOTE: If you are using a 3rd party name servers for your domain, you will have to add the DomainKeys in the DNS zone of your domain created on their servers.

Comments Off on How to add Domainkeys for a domain on a cPanel server?