Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm trying to use PHP 5.3.2 + Fcgid 2.3.5 + Apache 2.2.14 but I always have the error : "Connection reset by peer: mod_fcgid: error reading data from FastCGI server". And Apache returns an error 500 each time I tried to execute a php page :

I have compiled the Apache with this options:

./configure --with-mpm=worker --enable-userdir=shared --enable-actions=shared --enable-alias=shared --enable-auth=shared --enable-so --enable-deflate \
--enable-cache=shared --enable-disk-cache=shared --enable-info=shared --enable-rewrite=shared \
--enable-suexec=shared --with-suexec-caller=www-data --with-suexec-userdir=site --with-suexec-logfile=/usr/local/apache2/logs/suexec.log --with-suexec-docroot=/home

Then PHP:

./configure --with-config-file-path=/usr/local/apache2/php --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --with-zlib --enable-exif --with-gd --enable-cgi

Then FCdigd:

APXS=/usr/local/apache2/bin/apxs ./configure.apxs

The VHOST is:

 <Directory /home/website_panel/site/>
        FCGIWrapper /home/website_panel/cgi/php .php
 ...
         ErrorLog /home/website_panel/logs/error.log
  </Directory>



cat /home/website_panel/logs/error.log

[Sun Mar 07 22:19:41 2010] [warn] [client xx.xx.xx.xx] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server
[Sun Mar 07 22:19:41 2010] [error] [client xx.xx.xx.xx] Premature end of script headers: test.php
[Sun Mar 07 22:19:41 2010] [warn] [client xx.xx.xx.xx] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server
[Sun Mar 07 22:19:41 2010] [error] [client xx.xx.xx.xx] Premature end of script headers: test.php
[Sun Mar 07 22:19:42 2010] [warn] [client xx.xx.xx.xx] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server
[Sun Mar 07 22:19:42 2010] [error] [client xx.xx.xx.xx] Premature end of script headers: test.php
[Sun Mar 07 22:19:43 2010] [warn] [client xx.xx.xx.xx] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server
[Sun Mar 07 22:19:43 2010] [error] [client xx.xx.xx.xx] Premature end of script headers: test.php

The Suexec log:

root:/usr/local/apache2# cat /var/log/apache2/suexec.log

[2010-03-07 22:11:05]: uid: (1001/website_panel) gid: (1001/website_panel) cmd: php
[2010-03-07 22:11:15]: uid: (1001/website_panel) gid: (1001/website_panel) cmd: php
[2010-03-07 22:11:23]: uid: (1001/website_panel) gid: (1001/website_panel) cmd: php
[2010-03-07 22:19:41]: uid: (1001/website_panel) gid: (1001/website_panel) cmd: php
[2010-03-07 22:19:41]: uid: (1001/website_panel) gid: (1001/website_panel) cmd: php
[2010-03-07 22:19:42]: uid: (1001/website_panel) gid: (1001/website_panel) cmd: php
[2010-03-07 22:19:43]: uid: (1001/website_panel) gid: (1001/website_panel) cmd: php

root:/usr/local/apache2# cat logs/error_log

[Sun Mar 07 22:18:47 2010] [notice] suEXEC mechanism enabled (wrapper: /usr/local/apache2/bin/suexec)
[Sun Mar 07 22:18:47 2010] [notice] mod_bw : Memory Allocated 0 bytes (each conf takes 32 bytes)
[Sun Mar 07 22:18:47 2010] [notice] mod_bw : Version 0.7 - Initialized [0 Confs]
[Sun Mar 07 22:18:47 2010] [notice] Apache/2.2.14 (Unix) mod_fcgid/2.3.5 configured -- resuming normal operations

root:/usr/local/apache2# /home/website_panel/cgi/php -v

PHP 5.3.2 (cli) (built: Mar  7 2010 16:01:49)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

If someone has got an idea, I want to hear it ^^

Thanks !

share|improve this question

closed as too broad by kce, Michael Hampton Jul 31 '13 at 5:07

There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs.If this question can be reworded to fit the rules in the help center, please edit the question.

2 Answers 2

I found this, because i had the same error-message.

The reason was as simple as obvious. I mistype the SuExec Directive in the Virtuolhost-Config. The User and Group differ from the file owners.

share|improve this answer

I was also getting these errors:

(104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server
Premature end of script headers: test.fcgi

There are many things that can result in this happening, but in my particular case (which took me far too long to figure out) the FastCGI script didn't have the correct SELinux context set.

This made everything better:

% chcon system_u:object_r:httpd_sys_script_exec_t:s0 ./test.fcgi
share|improve this answer