• We value your experience with Plesk during 2024
    Plesk strives to perform even better in 2025. To help us improve further, please answer a few questions about your experience with Plesk Obsidian 2024.
    Please take this short survey:

    https://pt-research.typeform.com/to/AmZvSXkx
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

error reading data from FastCGI server

acscomputer

Basic Pleskian
Hello, I got a problem:

PleskLog File

104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server
[Mon Jun 22 15:33:11 2015] [error] [client 176.10.112.11] Premature end of script headers: import_cop.php

and Apache Log

[Mon Jun 22 11:06:57 2015] [error] server reached MaxClients setting, consider raising the MaxClients setting
[Mon Jun 22 15:46:17 2015] [error] (12)Cannot allocate memory: fork: Unable to fork new process
PHP Warning: Module 'zip' already loaded in Unknown on line 0

How can I fix this problem? The Script is 100% i/O because it has worked onder PHP 5.2 and its comp. whit 5.4.
 
#1 - Find out which mpm you are running

Have a look at '/etc/httpd/conf.modules.d/00-mpm.conf' to find out which mpm is active (the one, that is not commented - prefork, worker or event).
If you are running prefork it would be a good idea to switch to worker mpm - I'm running mpm-event (stable since Apache 2.4) without any problems on my servers.
You are running CentOS 6, so the worker mpm would be a good choice.

#2 - Create a configuration file for your chosen mpm

Create the file '/etc/httpd/conf.modules.d/99-my-mpm.conf' and fill it with your desired configuration for your mpm. There is no 'best' configuration available - it
depends on your hardware and your workload - so you'll have make your own configuration - test and tweak it till it fits your needs.

A good starting point is the apache documentation - http://httpd.apache.org/docs/2.2/mod/worker.html

Example (don't use it :) ):

Code:
<IfModule mpm_event_module>
    KeepAlive On
    KeepAliveTimeout 15
    MaxKeepAliveRequests 100
    ServerLimit 10
    StartServers 3
    ThreadLimit 64
    ThreadsPerChild 64
    MinSpareThreads 192
    MaxSpareThreads 256
    MaxRequestWorkers 640
    MaxConnectionsPerChild 10000
</IfModule>

#3 - Restart or reload apache

service httpd restart

or

service httpd force-reload
 
Last edited:
It's likely that you will find what you need to change in /etc/httpd/conf.d/httpd.conf

Look for the section starting with # prefork MPM and within the <IfModule prefork.c> block change MaxClients to a value that is appropriate for your installation (it's not a good idea to just set a value without understanding the implications).

Alternatively if you're in an adventurous mood and just want to see what happens, try doubling the value and then watching your system's peformance to see if that helps.
 
Hello Pleskpanel, I made the canges in /etc/httpd/conf/httpd.conf

under /etc/httpd/conf.d/httpd.conf there is no httpd.conf....

If I restart Apache I get the message

Starting httpd: WARNING: MaxClients of 20 exceeds ServerLimit value of 10 server s,
lowering MaxClients to 10. To increase, please see the ServerLimit
directive.

Its a root Server, but its running on OpenVZ
 
I change it here and no it works. Now its like this

# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# ServerLimit: maximum value for MaxClients for the lifetime of the server
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule prefork.c>
StartServers 1
MinSpareServers 1
MaxSpareServers 5
ServerLimit 20
MaxClients 20
MaxRequestsPerChild 4000
</IfModule>

# worker MPM
# StartServers: initial number of server processes to start
# MaxClients: maximum number of simultaneous client connections
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule worker.c>
StartServers 1
MaxClients 20
MinSpareThreads 1
MaxSpareThreads 4
ThreadsPerChild 25
MaxRequestsPerChild 0
</IfModule>


Its a Quad Core Server whit 8GB of RAM about 3GB free while ruinning the script..
it uses 3 CPU Cores only. Is there any whay to activate the 4. Core ?

The script needs about 15min to run.


Now I get this in Error.log

PHP Warning: Module 'zip' already loaded in Unknown on line 0
[Tue Jun 23 12:15:34 2015] [notice] caught SIGTERM, shutting down
[Tue Jun 23 12:15:42 2015] [error] FastCGI process 14062 still did not exit, terminating forcefully
 
I get again

[Tue Jun 23 14:32:58 2015] [warn] [client ] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server
[Tue Jun 23 14:32:58 2015] [error] [client ] Premature end of script headers: xy.php
 
That's quite a script there there - Without even running through the math with respect to process size and available memory it looks like you're limiting your resources - have you taken a look at your fcgi.conf file (in the same directory) as well? Without knowing what you're doing you could likely safely bump that MaxClients/ServerLimit value to 100 as well
 
Yes:

# This is the Apache server configuration file for providing FastCGI support
# via mod_fcgid
#
# Documentation is available at http://fastcgi.coremail.cn/doc.htm

LoadModule fcgid_module modules/mod_fcgid.so

<IfModule mod_fcgid.c>

<IfModule !mod_fastcgi.c>
AddHandler fcgid-script fcg fcgi fpl
</IfModule>

FcgidIPCDir /var/run/mod_fcgid/sock
FcgidProcessTableFile /var/run/mod_fcgid/fcgid_shm

FcgidIdleTimeout 240
FcgidProcessLifeTime 3600
FcgidMaxProcesses 300
FcgidMaxProcessesPerClass 8
FcgidMinProcessesPerClass 0
FcgidConnectTimeout 900
FcgidIOTimeout 1500
FcgidInitialEnv RAILS_ENV production
FcgidIdleScanInterval 10

</IfModule>

which value must be increased?
 
Back
Top