Archive for the ‘plesk’ Category

adjust /etc/php.ini (default path)
then /usr/local/psa/bin/php_settings –update-all -> it modifies all websites php.ini according to server /etc/php.ini

# /usr/local/psa/bin/php_settings –help

Usage: php_settings command [options]
Available commands:
–update-all or -u Update per-domain PHP settings of all domains in accordance with the server-wide php.ini file.

create /var/www/vhosts/$DOMAIN$/conf/vhost.conf


<DIRECTORY /var/www/vhosts/$DOMAIN$/httpdocs>

<IfModule sapi_apache2.c>

php_admin_flag engine on

# General settings

php_admin_flag safe_mode off

php_admin_value open_basedir "/var/www/vhosts/$DOMAIN$/:/tmp/"

# Performance settings (not mandatory)

php_admin_value memory_limit 512M

php_admin_value max_execution_time 600

php_admin_value max_input_time 300

php_admin_value post_max_size 60M

php_admin_value upload_max_filesize 60M

# Additional directives



<DIRECTORY /var/www/vhosts/$DOMAIN$/httpdocs>

<IfModule mod_php5.c>

php_admin_flag engine on

# General settings

php_admin_flag safe_mode off

php_admin_value open_basedir "/var/www/vhosts/$DOMAIN$/:/tmp/"

# Performance settings

php_admin_value memory_limit 512M

php_admin_value max_execution_time 600

php_admin_value max_input_time 300

php_admin_value post_max_size 60M

php_admin_value upload_max_filesize 60M

# Additional directives

   AddHandler php5-script .hph

   AddType text/html .hph



/usr/local/psa/admin/sbin/httpdmng --reconfigure-domain $DOMAIN$

and voila..

if plesk is not running and you see in /tmp/autoinstaller3.log this:

Package matching php-5.3.3-3.el6_2.5.i686 already installed. Checking for update.
Running rpm_check_debug
Exception: Scriptlet or other non-fatal errors occurred during transaction.

ERROR: Failed to run the Yum utility.
The Yum utility failed to install the required packages.
Attention! Your software might be inoperable.
Please, contact product technical support.

then you have to update php by hand yum update php
then to run /usr/local/psa/admin/bin/autoinstaller --upgrade-installed-components --select-release-current wich will upgrade installed components (as auto upgrade option in plesk does automatically) and plesk interface will start again.

tested on Horde: 3.1.7

don’t be tricked by these errors in log:
[error] [client ….] PHP Deprecated: Assigning the return value of new by reference is deprecated in /usr/share/psa-pear/PEAR.php
the errors can be disabled in /usr/share/psa-horde/config/conf.php

If you get white page [500 error] after login on horde you can try this:
edit files:

/usr/share/psa-horde/imp/lib/IMAP/Client.php line 576
modify     function namespace($additional = array())
with       function plmnamespace($additional = array())
/usr/share/psa-horde/imp/lib/Session.php line 295
modify     $_SESSION['imp']['namespace'] = $imapclient->namespace($user_namespace);
with       $_SESSION['imp']['namespace'] = $imapclient->plmnamespace($user_namespace);

reload the webmail page and logout/login again.

Please let me know if this helps you. Feedback is appreciated.

modify all this files to get everything working properly

./IMAP/Tree.php:78: $ptr = reset($_SESSION[‘imp’][‘plmnamespace’]);
./IMAP/Tree.php:83: $this->_namespaces = (empty($GLOBALS[‘conf’][‘user’][‘allow_folders’])) ? array() : $_SESSION[‘imp’][‘plmnamespace’];
./IMAP/Tree.php:184: foreach ($_SESSION[‘imp’][‘plmnamespace’] as $val) {
./Folder.php:139: $delimiter = reset($_SESSION[‘imp’][‘plmnamespace’]);
./Folder.php:678: foreach ($_SESSION[‘imp’][‘plmnamespace’] as $val) {
./Session.php:259: $_SESSION[‘imp’][‘plmnamespace’] = $ptr[‘imap_config’][‘plmnamespace’];
./Session.php:265: $_SESSION[‘imp’][‘plmnamespace’] = array();
./Session.php:268: $user_namespace = (isset($ptr[‘plmnamespace’]) && is_array($ptr[‘plmnamespace’])) ? $ptr[‘plmnamespace’] : array();
./Session.php:278: $_SESSION[‘imp’][‘plmnamespace’][$val] = array(‘name’ => $val, ‘delimiter’ => $box[0]->delimiter);
./Session.php:295: $_SESSION[‘imp’][‘plmnamespace’] = $imapclient->plmnamespace($user_namespace);
./Session.php:296: if (!is_array($_SESSION[‘imp’][‘plmnamespace’])) {
./Session.php:318: $_SESSION[‘imp’][‘plmnamespace’] = null;
./IMP.php:1195: reset($_SESSION[‘imp’][‘plmnamespace’]);
./IMP.php:1196: $mailbox = key($_SESSION[‘imp’][‘plmnamespace’]);
./IMP.php:1204: foreach ($_SESSION[‘imp’][‘plmnamespace’] as $key => $val) {
./IMP.php:1211: if ($empty && isset($_SESSION[‘imp’][‘plmnamespace’][”])) {
./IMP.php:1212: $cache[$key][$mailbox] = $_SESSION[‘imp’][‘plmnamespace’][”];
./IMP.php:1236: foreach ($_SESSION[‘imp’][‘plmnamespace’] as $val) {

P.S. If you copy/paste the content to your blog, please quote the source 🙂

Since plesk 9.5, you can choose in plesk how php will run (as apache module will be executed as apache user, as cgi/fastcgi will be executed as domain user/system user)

$ wget -q -O - | sh
rpm --import
$ yum install mod_suphp

edit the /etc/httpd/conf.d/mod_suphp.conf and leave only LoadModule suphp_module modules/ line
modify /etc/suphp.conf:

$ [global]


create file /etc/httpd/conf.d/zzz_suphp.conf with content:

$ <Directory /var/www/vhosts>
<IfModule mod_suphp.c>
AddHandler x-httpd-php .php .php3 .php4 .php5 .phtml
suPHP_AddHandler x-httpd-php
suPHP_Engine on

With this config you will enable the suPHP only for vhost folder and not for webmail and other folders.

You have also to check the file/folders permissions. If you have files/folders with 777 permission you will get a 500 error. You have to change it to 755 or 644.

How do I rebuild qmail queue if it is damaged or consists of a lot of spam messages?
Article ID: 252
Last Review: Mar,5 2009
Author: Vitaly Malakhov
Last updated by: Vitaly Malakhov APPLIES TO:

* Plesk 8.x for Linux/Unix
* Plesk 7.5.x Reloaded


This instruction is written for RPM-based systems (RedHat, Fedora, CentOS, etc…).

Please perform the following steps to recreate Qmail`s queue.


All current messages will be removed from the queue in this case and cannot be restored.

1. Stop Qmail and xinetd.

/etc/init.d/qmail stop
/etc/init.d/xinetd stop

2. Move current queue to another location.

mv /var/qmail/queue /var/qmail/queue_old

3 Reinstall ‘psa-qmail’ RPM to recreate qmail queue structure with the command like:

rpm -Uvh –force psa-qmail….

4.(Optional).Reinstall drweb-qmail RPM if you use DrWeb antivirus feature which comes with Plesk.

rpm -Uvh –force drweb-qmail….

5.Start Qmail and xinetd:

/etc/init.d/qmail start
/etc/init.d/xinetd start
Note: you should get the both psa-qmail and drweb-qmail RPMs from the same Plesk version distributive which is installed on the server.
You can obtain current psa-qmail, drweb-qmail RPMs and Plesk build versions by running the following commands on Linux systems:

rpm -q psa-qmail
rpm -q drweb-qmail
rpm -q psa

The server is saturated with SPAM. There are many messages in the queue. The mail is sent slowly.
Article ID: 766
Last Review: Mar,16 2009
Author: Daria Taranova
Last updated by: Daria Taranova APPLIES TO:

* Plesk 7.5.x Reloaded
* Plesk 9.x for Linux/Unix
* Plesk 8.x for Linux/Unix

First check that all domains have the option ‘Mail to non-existing user’ set to ‘reject’ but not to ‘forward’. You can change this setting to all domains using “Group Operations” in the “Domains” tab in Parallels Plesk Control Panel. The option “Reject mail to nonexistent user” is available since Parallels Plesk Panel 7.5.3.

Also, please, check that all the IPs and networks in the white lists are reliable and familiar to you.

Check how many messages are in the queue with Qmail:

# /var/qmail/bin/qmail-qstat
messages in queue: 27645
messages in queue but not yet preprocessed: 82

If the queue has too many messages, try to discover the source of SPAM.

If mail is being sent by an authorized user but not from the PHP script, you can run the command below to find the user that has sent the most messages (available since Plesk 8.x). Note that you must have the ‘SMTP authorization’ activated on the server to see these records:

# cat /usr/local/psa/var/log/maillog |grep -I smtp_auth |grep -I user |awk ‘{print $11}’ |sort |uniq -c |sort -n

The path to ‘maillog’ may differ depending on the OS you are using.

The next step is to use is “qmail-qread”, which can be used to read the message headers:

# /var/qmail/bin/qmail-qread
18 Jul 2005 15:03:07 GMT #2996948 9073 bouncing
done remote
done remote
done remote

This shows the senders and recipients of messages. If the message contains too many recipients, probably this is spam. Now try to find this message in the queue by its ID ( # 2996948 in our example):

# find /var/qmail/queue/mess/ -name 2996948

Examine the message and find the line “Received” to find out from where it was sent for the first time, for example, if you find:

Received: (qmail 19514 invoked by uid 10003); 13 Sep 2005 17:48:22 +0700

it means that this message was sent via a CGI by user with UID 10003. Using this UID it is possible to find the domain:

# grep 10003 /etc/passwd

If the ‘Received’ line contains a UID of a user ‘apache’ (for example invoked by uid 48) – it means that spam was sent through a PHP script. In this case, you can try to find the spammer using information from spam email (address from/to or any other information). It is usually very difficult to discover the source of SPAM. If you are absolutely sure that this time there is a script which sends SPAM (tail grows rapidly for no apparent reason), you can use the following script to know what PHP scripts are running at this time:

# lsof +r 1 -p `ps axww | grep httpd | grep -v grep | awk ‘ { if(!str) { str=$1 } else { str=str”,”$1}}END{print str}’` | grep vhosts | grep php

You can also apply KB article which describes the procedure of discovering which domains are sending mail through PHP scripts.

Lines in Received section like

Received: (qmail 19622 invoked from network); 13 Sep 2005 17:52:36 +0700
Received: from (

mean that the message has been accepted and delivered via SMTP, and that the sender is an authorized mail user.

IMPORTANT: Learn how to recreate the queue in Qmail

SELECT, mail.mail_name,, accounts.password, mail.postbox, mail.mbox_quota, mail.redirect, mail.redir_addr, mail_group, mail.autoresponder FROM mail, accounts, domains WHERE mail.account_id = AND mail.dom_id = AND = ‘domain.tld’;

1. Create a subdomain z-WILDCARD in Plesk – of course in the admin section of the right domain.
Why do we need this name? ’cause this entry should be the last entry in the list of subdomains, otherwise this
“trick” will not work. So if you have a domain as e.g. zabalula , than you should maybe name the subdomain zzzz-WILDCARD
or similar.
2. Add special configuration (catchall for all subdomains) to the vhosts.conf file of this subdomain.
Normally it’s located in /srv/www/vhosts/ You have to create it
– normally you need the root user to do this. Copy the following content into the file:
ServerAlias *
3. Apply the new configuration – recreate the Apache configuration. You have to run the tool websrvmng which is a
Plesk tool that manages and creates the webserver configuration. Execute the following as root user.
/usr/local/psa/admin/sbin/websrvmng -u
4. Finally – restart Apache to load the new configuration, also as root.
apache2ctl restart

create file if not exists: /var/www/vhosts/
<Directory /var/www/vhosts/>
php_admin_flag engine on
php_admin_value open_basedir none

/usr/local/psa/admin/sbin/websrvmng -u