Symptoms
-
The memory usage increased after installing Plesk updates.
-
RAM is used by dozens of
php-cgi
processes started by Apache:# top
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
26267 johndoe+ 20 0 810324 72704 3372 S 0.0 0.5 0:01.62 /opt/plesk/php/5.3/bin/php-cgi -c /var/www/vhosts/system/example.com/etc/php.ini
10022 janedoe+ 20 0 809084 71940 2108 S 0.7 0.5 0:01.72 /opt/plesk/php/5.3/bin/php-cgi -c /var/www/vhosts/system/example1.com/etc/php.ini
996 jadedoe+ 20 0 814800 68728 10556 S 0.0 0.5 0:04.24 /opt/plesk/php/5.3/bin/php-cgi -c /var/www/vhosts/system/example2.com/etc/php.ini -
Very big timeouts are specified in
/etc/httpd/conf.d/fcgid.conf
:FcgidIdleTimeout 2100
FcgidProcessLifeTime 2100
FcgidMaxProcesses 300
FcgidConnectTimeout 2100
FcgidIOTimeout 2100
FcgidBusyTimeout 2100
Cause
PHP-CGI processes are consuming too much memory due to big timeout values in FastCGI configuration.
Resolution
Solution 1
-
Connect to the server via SSH
-
Open
/etc/httpd/conf.d/fcgid.conf
in any text editor -
Decrease timeouts to lower values to finish
php-cgi
processes earlier, and executeservice httpd reload
command to reload Apache configuration. Default values are:FcgidIdleTimeout 40
FcgidProcessLifeTime 30
FcgidMaxProcesses 20
FcgidConnectTimeout 30
FcgidIOTimeout 45
FcgidIdleScanInterval 10Note: The drawback of this solution is the possible failure of long-running PHP scripts. If you are sure that there is no any on the server, you can follow this option.
Solution 2
Log in to Plesk, go to Domains > example.com > PHP settings and set PHP version to 7.0.33 and handler to FPM application served by nginx
:
Perform these configuration changes for every domain one by one.
Note: The drawback of this solution is possible websites' downtime due to switching to nginx. For example, domain-level .htaccess files can not be handled anymore, that can lead to website downtime. That's why it was recommended to switch the websites one by one, checking their availability.