logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: limit apache jobs spawning other jobs
Author
edwardsmarkf



Joined: 20 Feb 2013
Posts: 25
Location: cottonwood, az

PostPosted: Mon 08 Dec '14 18:08    Post subject: limit apache jobs spawning other jobs Reply with quote

hello all (newbie here)

i have about eight /usr/sbin/httpd processes running. each will start up multiple /usr/bin/php-cgi processes.

what is the best way to limit the number of /usr/bin/php-cgi processes that can start up?

i did try playing with the following values but wanted to get some expert opinions first:

Code:
<IfModule prefork.c>
StartServers       8
MinSpareServers    5
MaxSpareServers   20
ServerLimit      256
MaxClients       40     ## changed from 256
MaxRequestsPerChild  4000
</IfModule>

<IfModule worker.c>
StartServers         4
MaxClients         40    ## changed from 256
MinSpareThreads     25
MaxSpareThreads     75
ThreadsPerChild     25
MaxRequestsPerChild  0
</IfModule>


as always, any help or suggestions are greatly appreciated.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Mon 08 Dec '14 18:13    Post subject: Reply with quote

How is your PHP configured in apache config? Plan cgi or fcgid?
Back to top
edwardsmarkf



Joined: 20 Feb 2013
Posts: 25
Location: cottonwood, az

PostPosted: Mon 08 Dec '14 18:31    Post subject: Reply with quote

good question, and one i am not sure how to answer.

i am using webmin/virtualmin, and i have selected the second option: CGI wrapper:

Quote:
PHP script execution mode:
. . Apache mod_php (run as Apache's user)
. . CGI wrapper (run as virtual server owner)
. . FCGId (run as virtual server owner)


here is an example of what is in my http.conf file:

Code:
<VirtualHost 199.231.184.26:80>
SuexecUserGroup "#508" "#505"
ServerName mark.info
DocumentRoot /home/mark.info/public_html
ErrorLog /var/log/virtualmin/mark.info_error_log
CustomLog /var/log/virtualmin/mark.info_access_log combined
ScriptAlias /cgi-bin/ /home/mark.info/cgi-bin/
ScriptAlias /awstats/ /home/mark.info/cgi-bin/
DirectoryIndex index.html index.htm index.php index.php4 index.php5
<Directory /home/mark.info/public_html>
Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch +ExecCGI
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
AddHandler fcgid-script .php
AddHandler fcgid-script .php5
FCGIWrapper /home/mark.info/fcgi-bin/php5.fcgi .php
FCGIWrapper /home/mark.info/fcgi-bin/php5.fcgi .php5
</Directory>
<Directory /home/mark.info/cgi-bin>
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
</Directory>
RewriteEngine on
RewriteCond %{HTTP_HOST} =webmail.mark.info
RewriteRule ^(.*) https://mark.info:20000/ [R]
RewriteCond %{HTTP_HOST} =admin.mark.info
RewriteRule ^(.*) https://mark.info:10000/ [R]
RemoveHandler .php
RemoveHandler .php5
php_admin_value engine Off
IPCCommTimeout 31
FcgidMaxRequestLen 1073741824
Alias /dav /home/mark.info/public_html
Alias /pipermail /var/lib/mailman/archives/public
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Mon 08 Dec '14 18:35    Post subject: Reply with quote

ok. PHP seems to run over fcgid.

You can see on this page, http://www.apachelounge.com/viewtopic.php?t=2394 (fcgid settings) How you can controll the number of the PHP processes.
Back to top
edwardsmarkf



Joined: 20 Feb 2013
Posts: 25
Location: cottonwood, az

PostPosted: Mon 08 Dec '14 18:44    Post subject: Reply with quote

thank you very much james. i had a look at the article you sent me (and also authored, thank you very much!) - does this article primarly apply to fast-cgi? and i didnt see a section labeled "How you can controll the number of the PHP processes."

i loved the commentary at the top:
Quote:
One of the biggest topics here at Apache Lounge is running PHP on Apache.
It is a topic that is constant and for some reason often confused.
Confused namely by varying ways to accomplish the same thing.


once again, any assistance is very greatly appreciated, especially tolerance for foolish newbies such as myself.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Mon 08 Dec '14 19:20    Post subject: Reply with quote

Well there is a code section in that topic where you can find FcgidMaxProcesses.

You may also take a look at http://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html
Back to top


Reply to topic   Topic: limit apache jobs spawning other jobs View previous topic :: View next topic
Post new topic   Forum Index -> Apache