Saturday, February 25, 2023

Website loads slowly. What can be checked?

 

How HTTP client-server interaction works:

A Web server receives a request from a client for index.php page, for example, generates a page with static HTML content and sends to the client. This is Time to First byte (TTFB).

Then client web browser starts executing index.php: requests content mentioned in the page – various scripts, images etc. The scripts are delivered from the server and web browser starts executing them.

Possible causes
  • Slow DNS servers are used or dns servers reachability issues.
  • Server-side problems: web or MySQL service workload/bad optimisation.
  • Network problems: connection is not stable or bandwidth is not sufficient.
  • Site uses not optimal PHP version
  • Website code problems: content size and website code optimization.


Wednesday, February 1, 2023

MySQL fails to start when a Plesk server lacks disk space: SQLSTATE[HY000] No space left on device 500 Plesk\Exception\Database

 Symptoms:

When opening Plesk or exporting/importing a database in Plesk, the operation fails with one of the following error messages:

ERROR: Plesk\Exception\Database
DB query failed: SQLSTATE[HY000]: General error: 1021 Disk full (/var/tmp/#sql_3b95_1); waiting for someone to free some space..., <...>

Server Error
500 Plesk\Exception\Database
DB query failed: SQLSTATE[HY000]: General error: 1 Can't create/write to file '/var/tmp/#sql_9d1_0.MAI' (Errcode: 28), <...>

Server Error
500
Zend_Db_Adapter_Exception
SQLSTATE[HY000][2002] No such file or directory


This page isn’t working
203.0.113.2 is currently unable to handle this request.
HTTP ERROR 500


The MySQL service fails to start with the "No space left on device" error in its status:


# systemctl status mariadb.service

systemd[1]: Starting MariaDB database server...
systemd[1]: mariadb.service failed to run 'start-pre' task: No space left on device
systemd[1]: Failed to start MariaDB database server.
systemd[1]: mariadb.service failed


Cause:

# df -hT

Filesystem Size Used Avail Use% Mounted on
/dev/sda3 50G 50G 20K 100% /

Or

#df -i

Filesystem Inodes IUsed IFree IUse% Mounted on
tmpfs 483902 1 483901 1% /dev/shm
/dev/sda3 3276800 3276800 0 100% /


Resolution:


Remove the unwanted files in /tmp and /var/tmp

# find /var/tmp -type f -mtime +14 -exec rm {} \;

# find /tmp -type f -mtime +14 -exec rm {} \;

Saturday, January 28, 2023

Plesk Webhosting Control

 Plesk is a popular web hosting control panel that allows users to manage their websites, email accounts, and DNS settings from a single, user-friendly interface. Developed by Plesk International GmbH, the software is available for both Windows and Linux operating systems and is used by web hosts and hosting resellers to provide their customers with an easy way to manage their web presence.

One of the main advantages of Plesk is its ease of use. The control panel has a simple, intuitive interface that makes it easy for users to navigate and find the tools and settings they need. This is particularly useful for users who are new to web hosting and may not be familiar with the technical aspects of managing a website.

Plesk also provides a wide range of features and tools that are designed to help users manage their websites and online presence. Some of the key features of Plesk include the ability to create and manage email accounts, manage DNS settings, and access detailed website statistics. Additionally, Plesk provides a number of security features, such as password-protected directories and IP blocking, that can help protect users' websites from unauthorized access.

Another advantage of Plesk is its scalability. The software can be used by both small businesses and large enterprises and can be customized to meet the specific needs of each user. This makes it a versatile solution for web hosting providers and hosting resellers who need to provide their customers with a range of hosting options.

In conclusion, Plesk is a powerful and user-friendly web hosting control panel that provides a wide range of features and tools to help users manage their websites and online presence. Its ease of use, scalability, and security features make it an attractive solution for both web hosts and hosting resellers, as well as for individual users.

Thursday, August 4, 2016

[How to] How to fix InnoDB corruption cases for the MySQL database

  1. The following error is shown in Plesk:
    ERROR: PleskMainDBException
    MySQL query failed: Incorrect information in file: './psa/misc.frm'
    
  2. Plesk upgrade fails with the following error:
    DATABASE ERROR!!!
    Database psa found, but version undefined
    
  3. The MySQL service does not start:
    /etc/init.d/mysqld start
    Timeout error occurred trying to start MySQL Daemon.
    Starting MySQL:                                            [FAILED]
    
  4. mysqldump and mysqlcheckfail with an error message claiming a table does not exist (use the MySQL administrator account to check):
    mysqlcheck -uadmin -p****** db_example
    
    db_example.BackupTasks
    error    : Can't find file: 'BackupTasks.MYD' (errno: 2)
    
  5. A table cannot be properly queried with the SELECTstatement:
    mysql> select * from db_example.misc;
    ERROR 1033 (HY000): Incorrect information in file: './db_example/misc.frm'
    
  6. The table cannot be repaired because the InnoDB engine does not support reparation.
    mysql> repair table misc;
    +-------------------------+--------+----------+---------------------------------------------------------+
    | Table                   | Op     | Msg_type | Msg_text                                                |
    +-------------------------+--------+----------+---------------------------------------------------------+
    | psa.APSApplicationItems | repair | note     | The storage engine for the table doesn't support repair |
    +-------------------------+--------+----------+---------------------------------------------------------+
    
  7. The following information can be found in the MySQL log file:
    150704 19:09:27 InnoDB: Waiting for the background threads to start
    150704 19:09:28 InnoDB: Error: tablespace size stored in header is 3712 pages, but
    150704 19:09:28 InnoDB: the sum of data file sizes is only 3072 pages
    150704 19:09:28 InnoDB: Cannot start InnoDB. The tail of the system tablespace is
    150704 19:09:28 InnoDB: missing. Have you edited innodb_data_file_path in my.cnf in an
    150704 19:09:28 InnoDB: inappropriate way, removing ibdata files from there?
    150704 19:09:28 InnoDB: You can set innodb_force_recovery=1 in my.cnf to force
    150704 19:09:28 InnoDB: a startup if you are trying to recover a badly corrupt database.
    

Cause

InnoDB corruption.
Most InnoDB corruptions are hardware-related. Corrupted page writes can be caused by power failures or bad memory. The issue also can be caused by using network attached storage (NAS) and allocating InnoDB databases on it.

Resolution

Note: Since the MySQL service's control, logs and configuration file's location is different on the different operating systems, this article provides general command examples only.

I. Force InnoDB Recovery

  1. Stop the affected MySQL service. See the note above regarding service's control.
  2. Back up all the MySQL data storage files. They are located in the following directories:
    /var/lib/mysql/ - all databases on Linux
    %plesk_dir%\Databases\MySQL\Data\- customers' databases on Windows
    %plesk_dir%\MySQL\Data\ - Plesk-related databases (psa, apsc, horde) on Windows.
    For example:
    # mkdir /root/mysql_backup
    # cp -a /var/lib/mysql/* /root/mysql_backup/
    
  3. Set theinnodb_force_recoveryvalue under the [mysqld]section ([PleskSQLServer]for Plesk SQL Server on Windows) in the MySQL configuration file. This option will allow you to start MySQL service and create all databases dump.
    For example:
    # vi /etc/my.cnf
    [mysqld]
    innodb_force_recovery = 1
    
    WARNING: Only setinnodb_force_recovery to a value greater than 0 in an emergency situation, so that you can start InnoDB and dump your tables. Values of 4 or greater can permanently corrupt data files. Therefore, increase this value incrementally, as necessary. Please see more details in the official MySQL Documentation.
  4. Start the MySQL service.
  5. Try to dump all databases:
    # MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysqldump -uadmin -A | sed '1i\SET FOREIGN_KEY_CHECKS = 0;' > /root/dumpall.sql
    
    • If the dump fails with an error that reads:
      Incorrect information in file: './psa/APSApplicationItems.frm' when using LOCK TABLES"`
      
      then you need to increaseinnodb_force_recoveryand try to dump the databases again.
    • If you are not able to dump the databases, then try using method II ("Copy table content") or III ("Restore from the backup") below.
  6. Remove all the MySQL data storage files except the mysqlfolder. For example:
    # rm -rf `ls -d /var/lib/mysql/* | grep -v "/var/lib/mysql/mysql"`
    
  7. Remove theinnodb_force_recoveryoption from the MySQL configuration file.
  8. Restart the MySQL service.
  9. Check the MySQL log file for any errors.
  10. Restore the databases from the dump made on the step #5 above. For example:
    # MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -u admin < /root/dumpall.sql
    

II. Copy table contents

  1. Repeat steps #1-4 from themethod I to back up all the MySQL data storage files and enable InnoDB recovery mode.
  2. Try to make a copy of a table:
    CREATE TABLE <new_table> LIKE <crashed_table>;
    INSERT INTO <new_table> SELECT * FROM <crashed_table>;
    
  3. If the copy was created successfully, then drop the corrupted table and rename the new table to the old one.
    DROP TABLE <crashed_table>;
    RENAME TABLE <new_table> TO <crashed_table>;
    
    Note: Depending on your MySQL version it might be necessary to set lowerinnodb_force_recoveryvalue or remove it from the MySQL configuration file and restart MySQL service to successfully perform the DROPand RENAME operations. Please see more details in the official MySQL Documentation.

III. Restore from a backup

If the instructions above did not help, the only remaining method is to restore the databases from backups. Do not forget to remove theinnodb_force_recovery option from the MySQL configuration file before restore.
  • To restore Plesk-related databases (psa, apsc, horde) see the KB #881. For example:
    # ls -l /var/lib/psa/dumps
    -rw------- 1 root   root   141960 Aug  8 01:03 mysql.daily.dump.0.gz
    -rw------- 1 root   root   141925 Aug  7 01:03 mysql.daily.dump.1.gz
    
    # zcat /var/lib/psa/dumps/mysql.daily.dump.0.gz | MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -u admin psa
    
  • To restore customer's databases from Plesk backup see the Restoring Data from Backup Archives section in the Administrator's Guide.
Note: You may encounter timeouts when restoring databases. If so, set the wait_timeout value in the MySQL configuration file and restart the MySQL service. For example:
# vi /etc/my.cnf
[mysqld]
wait_timeout = 1800


"ERROR 1045 (28000): Access denied for user 'admin'@'localhost' (using password: YES)" when performing any changes in Plesk or in database directly

Make sure that the admin user has all privileges:
  • Log into MySQL server:
    # MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -u admin mysql
    
  • Check admin privileges:
    mysql> SHOW GRANTS FOR 'admin'@'localhost'\G
    
  • Grant all privileges toadmin if required:
    GRANT ALL ON *.* TO 'admin'@'localhost' WITH GRANT OPTION;
    FLUSH PRIVILEGES;
    1. check/var/log/mysqld.log.
    If you see a message such as:
    [ERROR] Missing system table mysql.proxies_priv; please run mysql_upgrade to create it
    
    this probably means that MySQL was reinstalled or was not upgraded completely. Run the following command to update MySQL:
        MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql_upgrade -uadmin

451 Error: queue file write error (only when using postfix)

Some of my clients complained that they can't send e-mails with attachments.
I checked it and it seems postfix generates 451 errors (queue file write error).
I executed the command postfix set-permissions but it didn't solved the problem.
The maillog doesn't have any detailed information about this error: 

Dec 15 23:01:13 jupiter before-queue[26830]: errno: Broken pipe
Dec 15 23:01:13 jupiter before-queue[26830]: System error: Broken pipe
Dec 15 23:01:13 jupiter before-queue[26830]: Unable to write data to stream
Dec 15 23:01:13 jupiter before-queue[26830]: Some error occured
Dec 15 23:01:13 jupiter postfix/spawn[26829]: warning: command /usr/lib/plesk-9.0/postfix-queue exit status 255 

I went back to qmail and now the server sends e-mails with attachments, but I would like to use postfix if it's possible. How can fix the 451 error? Any suggestions?

Saturday, September 28, 2013

How can i install mod_suphp in plesk server ?

For Centos 6.x 64 bit

rpm -ivh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm

For Centos 6.x 32 bit

rpm -Uvh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpm

yum install mod_suphp

Configuration:
--------------

Insert below lines to  /etc/suphp.conf file

[global]
;Path to logfile
logfile=/var/log/suphp.log

;Loglevel
loglevel=info

;User Apache is running as
webserver_user=apache

;Path all scripts have to be in
docroot=/var/www/vhosts

;Path to chroot() to before executing script
;chroot=/mychroot

; Security options
allow_file_group_writeable=false
allow_file_others_writeable=false
allow_directory_group_writeable=false
allow_directory_others_writeable=false

;Check wheter script is within DOCUMENT_ROOT
check_vhost_docroot=true

;Send minor error messages to browser
errors_to_browser=true

;PATH environment variable
env_path=/bin:/usr/bin

;Umask to set, specify in octal notation
umask=0022

; Minimum UID
min_uid=30

; Minimum GID
min_gid=30

[handlers]
;Handler for php-scripts
php5-script="php:/usr/bin/php-cgi"


Insert the below lines to /etc/httpd/conf.d/mod_suphp.conf

LoadModule suphp_module modules/mod_suphp.so


### Uncomment to activate mod_suphp
suPHP_AddHandler php5-script


# This option tells mod_suphp if a PHP-script requested on this server (or
# VirtualHost) should be run with the PHP-interpreter or returned to the
# browser "as it is".
suPHP_Engine on

Insert the below lines to /etc/httpd/conf.d/php.conf file

#
# PHP is an HTML-embedded scripting language which attempts to make it
# easy for developers to write dynamically generated webpages.
#

LoadModule php5_module modules/libphp5.so

#
# Cause the PHP interpreter to handle files with a .php extension.
#
AddHandler php5-script .php
AddType text/html .php

#
# Add index.php to the list of files that will be served as directory
# indexes.
#
DirectoryIndex index.php

#
# Uncomment the following line to allow PHP to pretty-print .phps
# files as PHP source code:
#
#AddType application/x-httpd-php-source .phps


Vhost configuration
------------------

Add the below lines to vhost.conf to activate mod_suphp

suPHP_Engine On
suPHP_UserGroup username psacln
suPHP_ConfigPath /var/www/vhosts/domain.com/etc

finally restart apache/httpd service for the changes to take effect.

Tuesday, September 3, 2013

Restore Plesk Server on a New server after primary (old) harddrive crashed

1. Attach the crashed hard drive as the secondary in the server  and mount to /old directory

2. Important: This step is only possible if version of MySQL server on both original and new servers match.
Start MySQL server with datadir parameter in /etc/my.cnf pointing to MySQL database location on old drive (/old/var/lib/mysql) and dump databases:
# mysql -uadmin -p`cat /old/etc/psa/.psa.shadow` -Dpsa -Ns -e"select name from data_bases where type = 'mysql'" | while read dbname ; do mysqldump -uadmin -p`cat /etc/psa/.psa.shadow` --databases $dbname > $dbname.sql ; done

Then stop MySQL, revert datadir parameter in /etc/my.cnf to its original value, start MySQL and restore databases:

# for f in *.sql ; do mysql -uadmin -p`cat /etc/psa/.psa.shadow` < $f ; done

3. Restore the Parallels Plesk Panel database from the available dump:
a) Stop Plesk service:
# /etc/init.d/psa stopall

b) Start MySQL server:
# /etc/init.d/mysqld start

c) Import the database dump:
zcat /old/var/lib/psa/dumps/mysql.daily.dump.0.gz | mysql -uadmin -p`cat /etc/psa/.psa.shadow`

4. Copy Plesk database password file:
# cp -rpf /old/etc/psa/.psa.shadow /etc/psa/.psa.shadow

5. (For Plesk 11.x) Copy encryption key to new server:
# cp /etc/psa/private/secret_key /etc/psa/private/secret_key.save
# cp -rpf /old/etc/psa/private/secret_key /etc/psa/private/secret_key

6.Alter table IP_Addresses if the set of IP addresses assigned to the new server has changed.

7. Restore domain content:
# rsync -av /old/var/www/vhosts/ /var/www/vhosts/

8. Restore Parallels Plesk Panel system users:
# mysql -uadmin -p`cat /etc/psa/.psa.shadow` -Dpsa -Ns -e"select s.login, a.password, s.home, s.shell from sys_users s, accounts a where a.id = s.account_id" | awk '{ print "PSA_PASSWD=\x27" $2 "\x27 /usr/local/psa/admin/sbin/usermng --add-user --user=" $1 " --homedir=" $3 " --shell=" ($4?$4:"/bin/false")}' | sh -x

For Plesk 10.x and later additionally following command should be executed:
# mysql -uadmin -p`cat /etc/psa/.psa.shadow` -Dpsa -Ns -e"select s1.login, s2.login from sys_users s1 left join sys_users s2 on s2.id = s1.mapped_to where s2.login is not null" | awk '{print "/usr/local/psa/admin/sbin/usermng --map-user --user=" $1 " --mapped-to=" $2}' | sh -x

9. Repair ownership on virtual hosts' content to fix files/directories owned by non-existing users:
For Plesk 10.x and 11.x:
# mysql -uadmin -p`cat /etc/psa/.psa.shadow` -Dpsa -Ns -e"SELECT s.home, h.www_root, s.login FROM hosting h, sys_users s WHERE s.id = h.sys_user_id" | while read home www_root login ; do content_uid=`stat --format=%u "$www_root"` ; find $home -uid $content_uid -exec chown $login '{}' + ; done

For Plesk 9.x and earlier:
# mysql -uadmin -p`cat /etc/psa/.psa.shadow` -Dpsa -Ns -e"SELECT home, login FROM sys_users" | while read home login ; do content_uid=`stat --format=%u "$home/httpdocs"` ; find $home -uid $content_uid -exec chown $login '{}' + ; done

10. Restore SSL certificates:
# cp -p  /old/usr/local/psa/var/certificates/* /usr/local/psa/var/certificates/

11. Regenerate webserver configuration:
For Plesk 8.x and 9.x:
# /usr/local/psa/admin/sbin/websrvmng –a -v
For Plesk 10.x:
# /usr/local/psa/admin/sbin/httpdmng --reconfigure-all

12. Restore mailnames content:
# rsync -av /old/var/qmail/mailnames/ /var/qmail/mailnames/
# chown -R popuser:popuser /var/qmail/mailnames/*

13. Repair mail configuration:
# /usr/local/psa/admin/sbin/mchk –-with-spam

14. Restore DNS zones:
For Plesk 9.x and earlier:
# mysql -uadmin -p`cat /etc/psa/.psa.shadow` psa -Ns -e  "select name from dns_zone" | awk '{ print "/usr/local/psa/admin/sbin/dnsmng update " $1 }' | sh -x

For Plesk 10.x and newer:
# mysql -uadmin -p`cat /etc/psa/.psa.shadow` psa -Ns -e  "select name from dns_zone" | awk '{ print "/usr/local/psa/admin/sbin/dnsmng --update " $1 }' | sh -x

15. Start Parallels Plesk Panel service:
# /etc/init.d/psa start

Friday, August 23, 2013

how to change php "open_basedir" in Plesk 10.4.4?

Check 1:
=====

Hard to tell why "none" works for some servers and doesn't for others - perhaps that may depend on PHP version installed. The following can be suggested to you:
1) set open_basedir to "{WEBSPACEROOT}:/tmp/" - while it doesn't make open_basedir comletely disabled, this setting will make your site able to include files from any other folder in your space, which should be enough for most cases
2) upgrade to Plesk 11 at http://parallels.com/download/plesk/11 - it is in pre-release phase and includes pre-configured "none" option for open_basedir (simply choose in dropdown menu). This one would completely disable open_basedir for your site


Check 2:
======
To modify this setting, create a vhost.conf file in your /var/www/vhosts/domain.com/conf/ directory, and enter the following lines:

<Directory /var/www/vhosts/domain.com/httpdocs>
php_admin_value open_basedir /path/you/require:/another/path/you/require
</Directory>

Then

/usr/local/psa/admin/sbin/httpdmng --reconfigure-all

MaxRequestLen Issue - Plesk Server

I'm not sure if Plesk upgrade to 10.3.1 is responsible for this issue, but it started occurring after a server was upgraded to Plesk 10.3.1.

Product: Parallels Plesk Panel Linux 10.3.1, version: psa v10.3.1_build1013110726.09 os_CentOS 5
Operating System: CentOS 5 i386. Kernel: 2.6.18-194.26.1.el5PAE
Architecture: i386

Problem Description:
When using PHP as FastCGI, if you try to upload a file larger than 128KB, an error "mod_fcgid: HTTP request length 131388 (so far) exceeds MaxRequestLen (131072)" occurs and causes an 550 internal server error.

Steps to reproduce:
1. Set PHP to run as FastCGI
2. Try to upload a file larger than 128KB using any PHP upload script.


Actual Results:
When using PHP as FastCGI, if you try to upload a file larger than 128KB, an error "mod_fcgid: HTTP request length 131388 (so far) exceeds MaxRequestLen (131072)" occurs and causes an 550 internal server error.
This happens because the value of MaxRequestLen directive is set to 131072 bytes (128KB) by default.
One way to correct this, is to edit /etc/httpd/conf.d/fcgid.conf and set MaxRequestLen to a higher value, for example 15MB (MaxRequestLen 15728640)


Expected Results:
MaxRequestLen should have been set to a higher value from the beginning to avoid such issues, 128KB is too low.

Additional Information:
This issue started occurring when a server was upgraded to Plesk 10.3.1.

Noticed that the file /etc/httpd/conf.d/fcgid.conf belongs to the package psa-mod_fcgid-2.3.6-11062118.i386. According http://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html , before the version 2.3.6 of this module, the default value of ​MaxRequestLen was 1GB, but since the 2.3.6 version, the default value of ​MaxRequestLen was changed to 128KB and that most likely caused the issue.
Therefore it seems Plesk is not directly responsible for this issue (mod_fcgid is) but since Parallels is using mod_fcgid in their package psa-mod_fcgid-2.3.6-11062118.i386

Solution:
=========
FcgidMaxRequestLen -->This is causing the problem. Before updating to the newest version, it was default set to 1gb. Now it is 128kb. Add the following to the file /etc/apache2/conf.d/fcgid.conf :

FcgidMaxRequestLen 1073741824

This wil give you a limit of 1gb. Next, restart your apache.

If you experienced the same problem on my Ubuntu 10.04 server after upgrading Plesk to 10.3.1. It took a while to figure out it was caused by this particular setting.

Now make the following change in the following file:
/etc/apache2/mods-available/fcgid.conf.

Almost on the end after the last row of Fcgi commands and before the </IfModule> just add:

FcgidMaxRequestLen 1073741824

error 503, service not available - Plesk Server

Almost every morning when logging into plesk panel i get the error message "error 503, service not available". after doing a "service psa restart" everything works again as it should. Means your plesk crashes such oftenly.

logs:
=====

DEBUGGER DETECTED... Bye!
2012-06-24 22:08:35: (mod_fastcgi.c.2613) unexpected end-of-file (perhaps the fastcgi process died): pid: 13042 socket: unix:/opt/psa/tmp/sw-engine.sock-0
2012-06-24 22:08:35: (mod_fastcgi.c.3357) child signaled: 9
2012-06-24 22:08:35: (mod_fastcgi.c.3400) response not received, request sent: 661 on socket: unix:/opt/psa/tmp/sw-engine.sock-0 for /login_up.php3?login_name=admin&passwd=0362092, closing connection
2012-06-25 07:47:29: (server.c.1543) server stopped by UID = 0 PID = 3593
2012-06-25 07:47:29: (log.c.166) server started
2012-06-25 07:47:56: (connections.c.1762) SSL (error): 5 -1 32 Broken pipe
2012-06-25 07:59:39: (connections.c.1762) SSL (error): 5 -1 32 Broken pipe
2012-06-25 08:13:03: (connections.c.1762) SSL (error): 5 -1 32 Broken pipe
2012-06-25 08:58:00: (connections.c.1762) SSL (error): 5 -1 32 Broken pipe
2012-06-25 09:55:21: (connections.c.1762) SSL (error): 5 -1 32 Broken pipe


Check with interesting logfiles beside of /opt/psa/admin/logs and /opt/psa/var/log?

Getting error when accessing plesk panel via web.

error_log:2012-06-24 07:27:44: (mod_fastcgi.c.3357) child signaled: 9
error_log:2012-06-24 22:08:35: (mod_fastcgi.c.3357) child signaled: 9
error_log.1:2012-06-17 13:18:49: (mod_fastcgi.c.3357) child signaled: 9
error_log.1:2012-06-17 22:29:50: (mod_fastcgi.c.3357) child signaled: 9
error_log.1:2012-06-20 19:54:46: (mod_fastcgi.c.3357) child signaled: 9
error_log.1:2012-06-21 03:24:27: (mod_fastcgi.c.3357) child signaled: 9
error_log.1:2012-06-23 03:06:06: (mod_fastcgi.c.3357) child signaled: 9
error_log.1:2012-06-23 03:10:22: (mod_fastcgi.c.3357) child signaled: 9

btw: i think i just found the reason why i'm not able to view logs via plesk panel although it looks like php was compiled with zlib:

error_log.1:2012-06-20 10:33:05: (mod_fastcgi.c.2746) FastCGI-stderr: PHP Fatal error: Call to undefined function gzopen() in /opt/psa/admin/
htdocs/domains/logs/log_file_viewer.php on line 59
error_log.1:2012-06-20 10:33:11: (mod_fastcgi.c.2746) FastCGI-stderr: PHP Fatal error: Call to undefined function gzopen() in /opt/psa/admin/
htdocs/domains/logs/log_file_viewer.php on line 59
error_log.1:2012-06-20 10:33:16: (mod_fastcgi.c.2746) FastCGI-stderr: PHP Fatal error: Call to undefined function gzopen() in /opt/psa/admin/
htdocs/domains/logs/log_file_viewer.php on line 59
error_log.1:2012-06-20 10:33:22: (mod_fastcgi.c.2746) FastCGI-stderr: PHP Fatal error: Call to undefined function gzopen() in /opt/psa/admin/
htdocs/domains/logs/log_file_viewer.php on line 59
error_log.1:2012-06-20 10:34:13: (mod_fastcgi.c.2746) FastCGI-stderr: PHP Fatal error: Call to undefined function gzopen() in /opt/psa/admin/
htdocs/domains/logs/log_file_viewer.php on line 59
error_log.1:2012-06-20 10:34:16: (mod_fastcgi.c.2746) FastCGI-stderr: PHP Fatal error: Call to undefined function gzopen() in /opt/psa/admin/htdocs/domains/logs/log_file_viewer.php on line 59

Also

"503 - Service Not Available"

# cat /var/log/error_log
2012-07-01 20:43:48: (mod_fastcgi.c.2613) unexpected end-of-file (perhaps the fastcgi process died): pid: 4333 socket: unix:/opt/psa/tmp/sw-engine-8880.sock-0
2012-07-01 20:43:48: (mod_fastcgi.c.3357) child signaled: 9
2012-07-01 20:43:48: (mod_fastcgi.c.3400) response not received, request sent: 654 on socket: unix:/opt/psa/tmp/sw-engine-8880.sock-0 for /login_up.php3?login_name=admin&passwd=07081990, closing connection
2012-07-01 23:19:11: (connections.c.1762) SSL (error): 5 -1 32 Broken pipe
DEBUGGER DETECTED... Bye!
2012-07-04 01:25:02: (mod_fastcgi.c.2613) unexpected end-of-file (perhaps the fastcgi process died): pid: 28404 socket: unix:/opt/psa/tmp/sw-engine.sock-0
2012-07-04 01:25:02: (mod_fastcgi.c.3357) child signaled: 9
2012-07-04 01:25:02: (mod_fastcgi.c.3400) response not received, request sent: 659 on socket: unix:/opt/psa/tmp/sw-engine.sock-0 for /login_up.php3?login_name=admin&passwd=alois, closing connection


As a root user:

TRY : 

1. /usr/local/psa/admin/sbin/httpdmng --reconfigure-all

2. Also try increasing the ulimit value

    - echo $ulimit
    - ulimit -n 131072 # sets ulimit value
    - In order to make this change permanent - add the following in /etc/sysctl.conf
        - fs.file-max = 131072
        - /sbin/sysctl -w fs.file-max=131072
3. Then mysql -uadmin -p`cat /etc/psa/.psa.shadow` psa -e "replace into misc (param,val) values ('apache_pipelog', 'true');"

4. /usr/local/psa/admin/sbin/httpdmng --reconfigure-all
5. /etc/init.d/httpd restart # restart httpd server.

qmail-queue-handlers problem SMTP is not working in plesk server

After automatic update of plesk 10.4 smtp stopped working. The service is up and running but no emails went out.

Error log shows this

Apr 28 12:49:03 ns1 qmail-queue-handlers[11039]: Handlers Filter before-queue for qmail started ...
Apr 28 12:49:03 ns1 qmail-queue-handlers[11039]: cannot create temporary file - (13) Permission denied
Apr 28 12:49:03 ns1 qmail-queue-handlers[11039]: cannot read message from stdin

1. Try with install rpm -Uvh --force plesk-mail-qc-driver-10.13.4-cos5.build1013120126.11.x86_64.rpm from the rpm here: http://64.131.90.31/PSA_10.4.4/dist-...t/maildrivers

2. Check with the following script

/usr/local/psa/admin/sbin/mchk --with-spam
==> Checking for: mailsrv_conf_init... ok
==> Checking for: mail_handlers_init... ok
==> Checking for: mailsrv_entities_dump... ok
==> Checking for: mail_admin_aliases... ok
==> Checking for: mail_auth_dump... ok
==> Checking for: mailman_lists_dump... ok
==> Checking for: mail_kav8_restore... ok
==> Checking for: mail_responder_restore... ok
==> Checking for: mail_spam_restore... ok
==> Checking for: mail_grey_restore... ok
==> Checking for: mail_mailbox_restore... ok
==> Checking for: mail_spf_restore... ok
==> Checking for: mail_dk_restore... ok
==> Checking for: mail_drweb_restore... not exists

When sending to the account, I get:

Jun 1 15:17:06 mydomain /var/qmail/bin/relaylock[26054]: /var/qmail/bin/relaylock: mail from 2.3.4.5:65049 (someother.server.com)
Jun 1 15:17:06 mydomain qmail-queue-handlers[26056]: Handlers Filter before-queue for qmail started ...
Jun 1 15:17:06 mydomain qmail-queue-handlers[26056]: from=person@someotherdomain.com
Jun 1 15:17:06 mydomain qmail-queue-handlers[26056]: to=person@mydomain.com
Jun 1 15:17:06 mydomain qmail-queue-handlers[26056]: handlers_stderr: SKIP
Jun 1 15:17:06 mydomain qmail-queue-handlers[26056]: SKIP during call 'check-quota' handler
Jun 1 15:17:06 mydomain qmail: 1338589026.699782 new msg 112152727
Jun 1 15:17:06 mydomain qmail-queue-handlers[26056]: starter: submitter[26058] exited normally
Jun 1 15:17:06 mydomain qmail: 1338589026.699827 info msg 112152727: bytes 1269 from <person@someotherdomain.com> qp 26058 uid 2020
Jun 1 15:17:06 mydomain qmail: 1338589026.702225 starting delivery 2: msg 112152727 to local 1-person@mydomain.com
Jun 1 15:17:06 mydomain qmail: 1338589026.702261 status: local 1/10 remote 0/20
Jun 1 15:17:06 mydomain qmail-local-handlers[26059]: Handlers Filter before-local for qmail started ...
Jun 1 15:17:06 mydomain qmail-local-handlers[26059]: cannot create temporary file - (13) Permission denied
Jun 1 15:17:06 mydomain qmail-local-handlers[26059]: cannot read message from stdin
Jun 1 15:17:06 mydomain qmail: 1338589026.705026 delivery 2: failure:
Jun 1 15:17:06 mydomain qmail: 1338589026.705078 status: local 0/10 remote 0/20
Jun 1 15:17:06 mydomain qmail-queue-handlers[26060]: Handlers Filter before-queue for qmail started ...
Jun 1 15:17:06 mydomain qmail-queue-handlers[26060]: cannot create temporary file - (13) Permission denied
Jun 1 15:17:06 mydomain qmail-queue-handlers[26060]: cannot read message from stdin
Jun 1 15:17:06 mydomain qmail: 1338589026.706767 warning: trouble injecting bounce message, will try later

When sending from the account, I get:

Jun 1 15:17:55 mydomain /var/qmail/bin/relaylock[26163]: /var/qmail/bin/relaylock: mail from 1.2.3.4:53533 (my.dsl.address.net)
Jun 1 15:17:56 mydomain cmd5checkpw: SMTP connect from my.dsl.address.net [1.2.3.4]
Jun 1 15:17:56 mydomain cmd5checkpw: SMTP user person@mydomain.com: logged in from my.dsl.address.net [1.2.3.4]
Jun 1 15:17:56 mydomain qmail-queue-handlers[26166]: Handlers Filter before-queue for qmail started ...
Jun 1 15:17:56 mydomain qmail-queue-handlers[26166]: from=person@mydomain.com
Jun 1 15:17:56 mydomain qmail-queue-handlers[26166]: to=person@someotherdomain.com
Jun 1 15:17:56 mydomain qmail-queue-handlers[26166]: handlers_stderr: SKIP
Jun 1 15:17:56 mydomain qmail-queue-handlers[26166]: SKIP during call 'check-quota' handler
Jun 1 15:17:56 mydomain qmail-queue-handlers[26166]: starter: submitter[26168] exited normally
Jun 1 15:17:56 mydomain qmail: 1338589076.594074 new msg 112152730
Jun 1 15:17:56 mydomain qmail: 1338589076.594108 info msg 112152730: bytes 662 from <person@mydomain.com> qp 26168 uid 2020
Jun 1 15:17:56 mydomain qmail: 1338589076.596951 starting delivery 3: msg 112152730 to remote person@someotherdomain.com
Jun 1 15:17:56 mydomain qmail: 1338589076.596978 status: local 0/10 remote 1/20
Jun 1 15:17:56 mydomain qmail-remote-handlers[26169]: Handlers Filter before-remote for qmail started ...
Jun 1 15:17:56 mydomain qmail-remote-handlers[26169]: cannot create temporary file - (13) Permission denied
Jun 1 15:17:56 mydomain qmail-remote-handlers[26169]: cannot read message from stdin
Jun 1 15:17:56 mydomain qmail: 1338589076.599152 delivery 3: failure: handlers_permanentfail/
Jun 1 15:17:56 mydomain qmail: 1338589076.599378 status: local 0/10 remote 0/20
Jun 1 15:17:56 mydomain qmail-queue-handlers[26170]: Handlers Filter before-queue for qmail started ...
Jun 1 15:17:56 mydomain qmail-queue-handlers[26170]: cannot create temporary file - (13) Permission denied
Jun 1 15:17:56 mydomain qmail-queue-handlers[26170]: cannot read message from stdin
Jun 1 15:17:56 mydomain qmail: 1338589076.601871 warning: trouble injecting bounce message, will try later

Maillog:

Jun 5 13:15:54 super qmail: 1338916554.142588 warning: trouble injecting bounce message, will try later
Jun 5 13:15:54 super qmail-queue-handlers[10293]: Handlers Filter before-queue for qmail started ...
Jun 5 13:15:54 super qmail-queue-handlers[10293]: cannot create temporary file - (13) Permission denied
Jun 5 13:15:54 super qmail-queue-handlers[10293]: cannot read message from stdin

I have tried all the solutions I have come across here and on the web:

1. Restarts
2. mchk --with-spam and w/o
3. persmissions double take on all the files
4. install Postfix - different problems
5. reinstalled Qmail afer Postfix install above
6. removed handlers and ran mchk to rebuild

The ./handlers/before-* and info directories are empty; only the hooks director contains the hooks; this even after reinstall after Postfix and mchk.

[ 10.4.4 ] - awstats.pl runs hours


I have no domains using awstats, but every day awstats.pl runs several hours to build stats. How can i completely disable awstats in plesk ?

1. You can disable it through cron. [ Cron daily script for Awstats is /etc/cron.daily/awstats ]
2. Statistics also calculated by daily maintenance script /etc/cron.daily/50plesk-daily

Plesk 11.5 roundcube webmail Connection to storage server failed.

Following are the tasks to perform if you receive "Connection to storage server failed" error message.

1. Check with the roundcube log located at /var/log/plesk-roundcube/errors
2. Check whether the Imap service is running in the server. You can check whether port 143 is listening
3. Check whether selinux is disabled.
4. Check with the disabled functions
5. Check with user permission issue for /var/qmail/mailnames/* [ usally popuser:popuser ]

Sunday, July 28, 2013

Troubleshooting your plesk server.

Plesk Servers:

Control Panel :

Error Log : /var/log/sw-cp-server/error_log
Access Log: /usr/local/psa/admin/logs/httpsd_access_log
Panel Log: /usr/local/psa/admin/logs/panel.log

Start: /etc/init.d/psa start
Stop: /etc/init.d/psa stop
Restart: /etc/init.d/psa restart

Configuration File:

Php: /usr/local/psa/admin/conf/php.ini
www: /etc/sw-cp-server/applications/plesk.conf
features: /usr/local/psa/admin/conf/site_isolation_settings.ini

Website Builder:

Log: /usr/local/psa/admin/logs/sitebuilder.log
Install / upgrade logs: /usr/local/sb/tmp

Configuration File:
/usr/local/sb/config
/etc/sw-cp-server/applications.d/plesk.conf
/usr/local/psa/admin/conf/php.ini


Backup Manager:

Backup logs:
/usr/local/psa/PMM/sessions/<session>/psadump.log
/usr/local/psa/PMM/sessions/<session>/migration.log
/usr/local/psa/PMM/logs/migration.log
/usr/local/psa/PMM/logs/pmmcli.log

Restore logs:
/usr/local/psa/PMM/rsessions/<session>/conflicts.log
/usr/local/psa/PMM/rsessions/<session>/migration.log
/usr/local/psa/PMM/logs/migration.log
/usr/local/psa/PMM/logs/pmmcli.log

Plesk Server Configuration File : /etc/psa/psa.conf

Apache:

Access and Error Logs : /var/log/httpd
Plesk domain logs: /var/www/vhosts/%d/statistics/logs/

Apache Start: /etc/init.d/start
Apache Stop: /etc/init.d/stop
Apache Restart: /etc/init.d/restart

Apache configuration file:
/etc/httpd/conf/httpd.conf
/etc/httpd/conf.d/
/usr/local/psa/admin/conf/ip_vhosts_bootstrap.conf
/usr/local/psa/admin/conf/vhosts_bootstrap.conf
/usr/local/psa/admin/conf/webmail_atmail_bootstrap.conf
/usr/local/psa/admin/conf/webmail_atmailcom_bootstrap.conf
/usr/local/psa/admin/conf/webmail_horde_bootstrap.conf

Generated Config Files:
/usr/local/psa/admin/conf/generated/<version>_server.include
/var/www/vhosts/<domain-name>/conf/<version>_httpd.include
/usr/local/psa/admin/conf/generated/<version>_horde.include
/usr/local/psa/admin/conf/generated/<version>_atmail.include
/usr/local/psa/admin/conf/generated/<version>_atmailcom.include
/usr/local/psa/admin/conf/generated/<version>_<domain_name>_webmail.include.

Tomcat:

/var/log/tomcat5

Tomcat start: /etc/init.d/tomcat5 start
Tomcat stop: /etc/init.d/tomcat5 stop
Tomcat restart: /etc/init.d/tomcat5 restart

Tomcat Configuration file: /usr/share/tomcat5/conf

FTP (proftpd)

Access and error logs: /usr/local/psa/var/log/xferlog

Configuration Files

/etc/xinetd.d/ftp_psa
/etc/proftpd.conf
/etc/proftpd.include

PostGreSQL server:

Startup log: /var/lib/pgsql/pgstartup.log

pgsql start : /etc/init.d/postgresql start
pgsql restart: /etc/init.d/postgresql restart
pgsql stop: /etc/init.d/postgresql stop

Configuration File:
/var/lib/pgsql/data/postgresql.conf

Courier (IMAP)

Access and Error Log: /usr/local/psa/var/log/maillog

Courier start : /etc/init.d/courier-imap start
Courier stop : /etc/init.d/courier-imap stop
Courier restart: /etc/init.d/courier-imap restart

SMTP Server (Postfix)

Access and Error logs : /usr/local/psa/var/log/maillog

Postfix start: /etc/init.d/postfix start
Postfix stop: /etc/init.d/postfix stop
Postfix restart: /etc/init.d/postfix restart

Configuration File location:

/etc/postfix/

SMTP Server (Qmail)

Access and Error Logs: /usr/local/psa/var/log/maillog

Qmail Start: /etc/init.d/qmail start
Qmail Stop: /etc/init.d/qmail stop
Qmail restart: /etc/init.d/qmail restart

Configuration File:
/etc/xinetd.d/smtp_psa
/etc/xinetd.d/smtps_psa
/etc/xinetd.d/submission_psa
/etc/inetd.conf (Debians)
/var/qmail/control/

Plesk SpamAssassin

Access and error log: /usr/local/psa/var/log/maillog

SpamAssassin start : /etc/init.d/psa-spamassassin start
SpamAssassin stop : /etc/init.d/psa-spamassassin stop
SpamAssassin restart: /etc/init.d/psa-spamassassin restart

Configuration File:
/etc/mail/spamassassin/
/etc/mail/spamassassin/local.cf
/var/qmail/mailname/%d/%l/.spamassassin

Drweb Antivirus:

Access and error log: /var/local/psa/var/log/maillog

drweb start: /etc/init.d/drwebd start
drweb stop: /etc/init.d/drwebd stop
drweb restart: /etc/init.d/drwebd restart

Configuration Files:
/etc/drweb/

Kaspersky antivirus:

Log: /usr/local/psa/var/log/maillog

Before 10.2
/var/log/kav/5.5/kav4mailservers/aveserver.log
/var/log/kav/5.5/kav4mailservers/smtpscanner.log
/var/log/kav/5.5/kav4mailservers/avstats.log
/var/log/kav/5.5/kav4mailservers/kavscanner.log
/var/log/kav/5.5/kav4mailservers/kavupdater.log

Since 10.2
Kaspersky start: /etc/init.d/kavehost start
Kaspersky stop : /etc/init.d/kavehost stop
Kaspersky restart: /etc/init.d/kavehost restart

Before 10.2:
Kaspersky start: /etc/init.d/aveserver start
Kaspersky stop : /etc/init.d/aveserver stop
Kaspersky restart: /etc/init.d/aveserver restart

Configuration files:

Before 10.2
/etc/kav/5.5./kav4mailservers/

Since 10.2:
/opt/kav/sdk813/etc/kav-handler.cfg
/etc/kavehost.xml

Plesk Server admin VPN (PSA VPN):

PSA VPN start: /etc/init.d/smb start
PSA VPN stop: /etc/init.d/smb stop
PSA VPN Restart: /etc/init.d/smb restart

Configuration File:
/usr/local/psa/var/modules/vpn/openvpn.conf

Plesk Server Firewall

Start : /etc/init.d/psa-firewall start
Stop : /etc/init.d/psa-firewall stop
Restart: /etc/init.d/psa-firewall restart

Configuration Files:

/usr/local/psa/var/modules/firewall/firewall-active.sh
/usr/local/psa/var/modules/firewall/firewall-emergency.sh
/usr/local/psa/var/modules/firewall/firewall-new.sh


Plesk Server Firewall ( IP Forwading )

Start: /etc/init.d/psa-firewall-forward start
Stop : /etc/init.d/psa-firewall-forward stop
Restart: /etc/init.d/psa-firewall-forward restart

Configuration Files:

/usr/local/psa/var/modules/firewall/ip_forwad.active
/usr/local/psa/var/modules/firewall/ip_forwad.saved


PhpPGAdmin: (PostgreSQL Admin)

Error log: /var/log/sw-cp-server/error_log

Configuration File: /var/local/psa/admin/htdocs/domains/databases/phpPgAdmin/conf/config.inc.php

PhpMyAdmin: (MySQL Admin)

Error log: /var/log/sw-cp-server/error_log

Configuration File: /usr/local/psa/admin/htdocs/domains/phpMyAdmin/libraries/config.default.php


Plesk Server Admin Log Rotate:

Start:  /usr/local/psa/bin/sw-engine-pleskrun /usr/local/psa/admin/plib/DailyMaintainance/script.php

Configuration File:
/usr/local/psa/etc/logrotate.conf
/usr/local/psa/etc/logrotate.d/

Awstats :

Start : /usr/local/psa/bin/sw-engine-pleskrun /usr/local/psa/admin/plib/DailyMaintainance/script.php

Configuration File:
/usr/local/psa/etc/awstats

Webalizer:

Start: /usr/local/psa/bin/sw-engine-pleskrun /usr/local/psa/admin/plib/DailyMaintainance/script.php

Configuration File:
/var/www/vhosts/%d/conf/webalizer.conf

Named:

Access and Error Logs: /var/log/messages

Named Start: /etc/init.d/named start
Named Stop: /etc/init.d/named stop
Named Restart: /etc/init.d/named restart

Configuration File:
/etc/named.conf



Tuesday, June 11, 2013

my mail not being delivered. (Postfix + Plesk)



A while back, I was having an issue with my mail not being delivered. I would write a function using 

< ? php mail();  ? >

and it would successfully send an email to every address EXCEPT one 
particular address.  I couldn’t tell why.  This is something that occurs
 on Parellels’ PLESK server administration software.  

I’ll get to it awfully quick, then I’ll tell you how I figured it out.
First, you need to ask yourself, is this email address the same domain being hosted on PLESK? Bingo. The problem was that when PostFix (the SMTP sendmail uses by default in most cases) determined the address to be the same as the domain it was hosting, it did a local search to find that address rather than just sending the email.
Naturally, if you didn’t have that particular email address set up, or any email with that extension set up on the server, it found nothing, and wouldn’t send the email. There is a very easy fix to this issue by commenting out 3 lines in your Postfix ‘main.cf’ configuration file

I can’t explain how helpful it was.
Find your ‘main.cf’ configuration file for PostFix, which for CentOS 6, is located at 

 /etc/postfix/main.cf 
If you can’t find it, do a
# which postfix
 
SSH command to at least see where Postfix is on your server.
Then, open the file up through a text editor, or in the Linux shell, and make these lines (should be at the end of the file, around line 677) :

virtual_mailbox_domains = $virtual_mailbox_maps, hash:/var/spool/postfix/plesk/virtual_domains
virtual_alias_maps = $virtual_maps, hash:/var/spool/postfix/plesk/virtual
virtual_mailbox_maps = hash:/var/spool/postfix/plesk/vmailbox

commented out like this :

#virtual_mailbox_domains = $virtual_mailbox_maps, hash:/var/spool/postfix/plesk/virtual_domains
#virtual_alias_maps = $virtual_maps, hash:/var/spool/postfix/plesk/virtual
#virtual_mailbox_maps = hash:/var/spool/postfix/plesk/vmailbox

Then, restart the Postfix service, and Apache. Your email address should be receiving those emails now. This also doesn’t affect any of your regular emails or anything else, either.
Now, I figured out how to look for this by checking over my mail logs. Any time you have an error with sending an email, check your mail logs. For CentOS, they are located:
 /usr/local/psa/var/log/maillog 
although for most Linux OS, they are located
 /var/log/maillog