Applicable to:
- Plesk for Linux
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
Click on a section to expand
-
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.
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.
Comments
2 comments
Can I changed the service plan with the suggestion 2? Will be the change applied to domains associates?
Thanks.
Luca
Hello, Luca!
If you want to change PHP version and handler in Service Plan and apply it to all the subscription associated with it then proceed with the following:
1. Ensure that option "PHP version and handler management" is unchecked at the Home > Service Plans > Service plan name > Permissions.
2. Change PHP setting at Home > Service Plans > Service plan name > PHP Settings.
3. Press Update & Sync button.
After that PHP Settings changes will be applied to all the synced subscription which associated with the affected Service Plan.
Please sign in to leave a comment.