Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 3 > Installation/Configuration

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 26th October 2012, 20:44
cbj4074 cbj4074 is offline
Senior Member
 
Join Date: Nov 2010
Posts: 392
Thanks: 29
Thanked 58 Times in 50 Posts
Default Intermittent 500 responses in access.log without corresponding entries in error.log

Hello,

I am experiencing an elusive problem with mod_fcgid (Fast-CGI) for Apache. In essence, Apache's access log contains intermittent 500 responses to which there is no clear pattern.

After several hours of debugging and research, I have determined that the root cause is not a "bug", per se, nor is it a problem with my PHP scripts. Rather, it is a limitation inherent to mod_fcgid's PHP implementation.

This issue surfaces on any system that uses mod_fcgid to execute PHP scripts because the module's default configuration values are set in a way that does not prevent it. I am somewhat surprised that more ISPConfig users have not noticed this. Then again, unless the server administrator is reviewing Apache's access log(s) carefully, the issue would likely go unnoticed. I noticed it only because I use logwatch, which sums each HTTP response code's occurrences over a given period of time. I began seeing several dozen 500 errors each day, none of which had corresponding entries in PHP's error log. This fact indicated that the problem was not with the PHP scripts.

For those curious as to the exact nature of the issue, please see my posts at the following URLs:

http://serverfault.com/questions/219...ttently/442768

http://mail-archives.apache.org/mod_...torrent.org%3E

One possible solution to the problem requires mod_fcgid's FcgidMaxRequestsPerProcess directive to be set to a value that is less than or equal to the value specified for the PHP_FCGI_MAX_REQUESTS environment variable (but greater than zero).

I have several questions:

1.) How/where should one specify the configuration directive value for FcgidMaxRequestsPerProcess on a sever running ISPConfig?

2.) Do PHP_FCGI_MAX_REQUESTS and FcgidMaxRequestsPerProcess represent the same directive?

3.) When are the cgi/fcgi wrapper scripts regenerated? Are these scripts regenerated only when the values in System -> Sever Config -> example.com -> CGI [tab] are modified?

I see that the PHP_FCGI_MAX_REQUESTS environment variable is defined (or overridden) in each site's Fast-CGI wrapper script (.php-fcgi-starter).

I would prefer to define FcgidMaxRequestsPerProcess in much the same way (on a per-site basis).

Should this directive be defined in the "Apache Directives" text area input field on the "Options" tab (of the Web Domain interface)?

If the answer to question 2) above is "yes", then perhaps ISPConfig should be modified to define FcgidMaxRequestsPerProcess (using the value defined for "FastCGI max. Requests" within the GUI) within each virtual host's configuration.

Perhaps these excerpts from the relevant documentation ( https://httpd.apache.org/mod_fcgid/m....html#examples ) will shed some light on question 2):

Configuration directives
Code:
# FcgidMaxRequestsPerProcess should be <= PHP_FCGI_MAX_REQUESTS
# The example PHP wrapper script overrides the default PHP setting.
FcgidMaxRequestsPerProcess 10000

# Uncomment the following line if cgi.fix_pathinfo is set to 1 in
# php.ini:
# FcgidFixPathinfo 1

Alias /phpapp/ /usr/local/phpapp/
<Location /phpapp/>
AddHandler fcgid-script .php
Options +ExecCGI
FcgidWrapper /usr/local/bin/php-wrapper .php

# Customize the next two directives for your requirements.
Order allow,deny
Allow from all
</Location>
PHP wrapper script - /usr/local/bin/php-wrapper
Code:
#!/bin/sh
# Set desired PHP_FCGI_* environment variables.
# Example:
# PHP FastCGI processes exit after 500 requests by default.
PHP_FCGI_MAX_REQUESTS=10000
export PHP_FCGI_MAX_REQUESTS

# Replace with the path to your FastCGI-enabled PHP executable
exec /usr/local/bin/php-cgi
Thanks for any help here!

Last edited by cbj4074; 26th October 2012 at 21:23. Reason: Added example snippets from relevant documentation
Reply With Quote
Sponsored Links
 

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
nginx & wordpress gives 500 pages EckyBrazz Server Operation 8 24th October 2012 00:06
vlogger (problem) cusco General 3 7th May 2012 15:32
Client access to access.log and error.log pavljiks Installation/Configuration 4 8th March 2011 20:33
ispconfig and mambo shajazzi Installation/Configuration 70 28th March 2006 19:29


All times are GMT +2. The time now is 23:29.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.