mod_fcgi produces random 500 Errors

Posted by DmitrySemenov on Server Fault See other posts from Server Fault or by DmitrySemenov
Published on 2012-09-25T02:07:35Z Indexed on 2012/09/25 3:39 UTC
Read the original article Hit count: 240

Filed under:
|
|
|
|

php 5.4.7 via mod_fcgi

when I run the site sometimes it works, sometimes it crashed with 500 Internal Error, this is what I see in error.log everytime I run the script

[Mon Sep 24 18:50:43 2012] [warn] [client 68.231.194.198] (104)Connection reset by peer:   mod_fcgid: error reading data from FastCGI server
[Mon Sep 24 18:50:43 2012] [error] [client 68.231.194.198] Premature end of script headers: api.php

any ideas?

vhost config:

<VirtualHost :80>
ServerAdmin [email protected]
DocumentRoot "/home/www/sites/test.com/html/development"
ServerName test.com
ServerAlias www.test.com
ErrorLog "/home/www/sites/test.com/logs/error_log"
CustomLog "/home/www/sites/test.com/logs/access_log" common

<IfModule mod_fcgid.c>
<Directory /home/www/sites/test.com/html/development>
  Options +ExecCGI
  AllowOverride All
  AddHandler fcgid-script .php
  FCGIWrapper /home/www/php-fcgi-scripts/php-fcgi-starter .php
  Order allow,deny
  Allow from all
</Directory>

FcgidMaxRequestLen 1073741824
</VirtualHost>

fcgi.d conf

LoadModule fcgid_module modules/mod_fcgid.so
# Use FastCGI to process .fcg .fcgi & .fpl scripts
AddHandler fcgid-script fcg fcgi fpl

# Sane place to put sockets and shared memory file
FcgidIPCDir /var/run/mod_fcgid
FcgidProcessTableFile /var/run/mod_fcgid/fcgid_shm

IdleTimeout 300
BusyTimeout 300
ProcessLifeTime 7200
IPCConnectTimeout 300
IPCCommTimeout 7200

PHP_Fix_Pathinfo_Enable 1

php-fcgi-starter.php

#!/bin/sh

PHP_CGI=/usr/local/php547/bin/php-cgi
PHP_INI=/etc/php547-fastcgi.ini

export PHP_FCGI_TIMEOUT=1200
#export PHP_FCGI_CHILDREN=6
export PHP_FCGI_MAX_REQUESTS=1000

exec $PHP_CGI -c $PHP_INI

© Server Fault or respective owner

Related posts about apache2

Related posts about php