| Author | 
  | 
dke
 
 
  Joined: 13 Jul 2007 Posts: 61 Location: sweden
  | 
 Posted: Sat 23 May '15 1:44    Post subject: Apache + MODFCGI configuration tips? | 
     | 
 
  | 
 
Hi,
 
 
I'm very confused how to benchmark and configure FCGI.
 
 
My current settings are:
 
 
 	  | Code: | 	 		  LoadModule fcgid_module modules/mod_fcgid.so
 
<IfModule fcgid_module>
 
   FcgidInitialEnv PATH "C:/Webserver/PHP;C:/WINDOWS/system32;C:/WINDOWS;C:/WINDOWS/System32/Wbem;"
 
   FcgidInitialEnv SystemRoot "C:/Windows"
 
   FcgidInitialEnv SystemDrive "C:"
 
   FcgidInitialEnv TEMP "C:/Webserver/PHP/TEMP"
 
   FcgidInitialEnv TMP "C:/Webserver/PHP/TEMP"
 
   FcgidInitialEnv windir "C:/WINDOWS"
 
   FcgidMaxProcesses 1000
 
   ThreadsPerChild 2048
 
   FcgidIOTimeout 1200
 
    FcgidConnectTimeout 1200
 
    FcgidBusyScanInterval 1200
 
    FcgidBusyTimeout 1200
 
    FcgidErrorScanInterval 1200
 
    FcgidIdleScanInterval 1200
 
    FcgidIdleTimeout 1200
 
    FcgidProcessLifeTime 3600
 
    FcgidZombieScanInterval 1200
 
   FcgidProcessLifeTime 400
 
   FcgidMaxRequestsPerProcess 9000
 
   FcgidMinProcessesPerClass 0
 
   FcgidMaxRequestLen 12131072
 
   # Location php.ini:
 
   FcgidInitialEnv PHPRC "C:/Webserver/PHP"
 
   FcgidInitialEnv PHP_FCGI_MAX_REQUESTS 10000
 
   FcgidInitialEnv PHP_FCGI_CHILDREN=0
 
 
   <Files ~ "\.php$">
 
      Options Indexes FollowSymLinks ExecCGI 
 
      AddHandler fcgid-script .php
 
      FcgidWrapper "C:/Webserver/PHP/php-cgi.exe" .php
 
   </Files>
 
</IfModule> | 	  
 
 
And i'm experiencing after site uptime over a couple of days without restarting apache it slows down, i get a lot of "mod_fcgi: process xxxxx gracful kill fail sending STRKILL.
 
 
If i lower the timeout values i get these too "End of script outbut before headers: file.php
 
 
Any idea how i can tweak it to work better?
 
 
8gb ram
 
ssd
 
windows 2012 server | 
 
  | 
| Back to top | 
 | 
James Blond Moderator
  
  Joined: 19 Jan 2006 Posts: 7442 Location: EU, Germany, Next to Hamburg
  | 
 Posted: Tue 26 May '15 18:04    Post subject:  | 
     | 
 
  | 
 
The mod_fcgi: process xxxxx gracful kill fail sending STRKILL. is normal since on windows the process nevers get killed graceful. I already posted a patch for that on the httpd dev mailing list. It will be in the next release of mod fcgid.
 
 
End of script outbut before headers 
 
it seems that your script run very long.
 
 
The works for me (TM) config on windows
 
 	  | Code: | 	 		  
 
<IfModule fcgid_module>
 
   FcgidConnectTimeout 10
 
   FcgidMaxProcesses 300
 
   FcgidMaxProcessesPerClass 300
 
   FcgidOutputBufferSize 64
 
   ProcessLifeTime 0
 
   FcgidMaxRequestsPerProcess 0
 
   FcgidMinProcessesPerClass 0
 
   FcgidFixPathinfo 0
 
   FcgidProcessLifeTime 0
 
   FcgidZombieScanInterval 20
 
   FcgidMaxRequestLen 536870912
 
   FcgidIOTimeout 120
 
   FcgidTimeScore 3
 
</IfModule>
 
 
<VirtualHost _default_:80>
 
   IndexOptions +XHTML
 
   HeaderName /HEADER.html
 
   DocumentRoot "/Users/james/work"
 
   CustomLog "C:\nul" common
 
   <IfModule fcgid_module>
 
      FcgidInitialEnv PHPRC "C:\\Users\james\\php5"
 
      FcgidInitialEnv PATH "C:\\Users\james\\php5;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;"
 
      FcgidInitialEnv SystemRoot "C:\\Windows"
 
      FcgidInitialEnv SystemDrive "C:"
 
      FcgidInitialEnv TEMP "C:\\WINDOWS\\TEMP"
 
      FcgidInitialEnv TMP "C:\\WINDOWS\\TEMP"
 
      FcgidInitialEnv windir "C:\\WINDOWS"
 
      FcgidPassHeader Authorization
 
      <Files ~ "\.php$">
 
         Options ExecCGI
 
         AddHandler fcgid-script .php
 
         FcgidWrapper "C:/users/james/php5/php-cgi.exe" .php
 
      </Files>
 
      <Files ~ "\.html$">
 
         Options Indexes FollowSymLinks ExecCGI
 
         AddHandler fcgid-script .html
 
         FcgidWrapper "C:/users/james/php5/php-cgi.exe" .html
 
      </Files>
 
   </IfModule>
 
   <Directory "/Users/james/work">
 
      Options Indexes FollowSymLinks
 
      AllowOverride None
 
      Require all granted
 
   </Directory>
 
</VirtualHost>
 
 | 	 
  | 
 
  | 
| Back to top | 
 | 
dke
 
 
  Joined: 13 Jul 2007 Posts: 61 Location: sweden
  | 
 Posted: Sun 31 May '15 22:14    Post subject:  | 
     | 
 
  | 
 
Thanks james, i managed to tweak the parameters to avoid having the "End of script outbut before headers"
 
 
What is your recommendation for a PHP cache? Back in the day i remember downloading eaccellerator from your site. PHP has some built in thing called "OPcache" is that equally as good?
 
 
What configurations would you set? | 
 
  | 
| Back to top | 
 | 
Smitty
 
 
  Joined: 03 Jan 2008 Posts: 197
 
  | 
 | 
| Back to top | 
 | 
James Blond Moderator
  
  Joined: 19 Jan 2006 Posts: 7442 Location: EU, Germany, Next to Hamburg
  | 
 Posted: Mon 01 Jun '15 16:43    Post subject:  | 
     | 
 
  | 
 
Yepp OPCache is awesome. The first request is slow and the following requests are fast. 
 
 
Cause it starts over when the php-cgi process dies after its lifetime or max. number of requests or if you restart apache. | 
 
  | 
| Back to top | 
 |