Perl Fast:CGI working, FSGI not

This is is a bit of strange issue for me, I’ve checked the syntax for the two code blocks, they checked out ok (using perl -cw test.fcgi). The difference is that CGI:Fast returns the expected result; FCGI gives an internal server error. Perl FCGI is enabled, Owners and permissions check out ok. The error in the log isn’t helpful:

[Thu Jan 30 04:00:49.373788 2020] [fcgid:warn] [pid 13320] (104)Connection reset by peer: [client] mod_fcgid: error reading data from FastCGI server
[Thu Jan 30 04:00:49.374680 2020] [core:error] [pid 13320] [client] End of script output before headers: test.fcgi

FCGI code
use FCGI;
use strict;

sub print_env {
    my($label, $envp) = @_;
    my @keys = sort keys(%$envp);
    foreach my $key (@keys) {

the CGI::Fast code, this one works:

use CGI::Fast;
use strict;

while (my $q = CGI::Fast->new) {
print(“Content-Type: text/plain\n\n”);
foreach $var (sort(keys(%ENV))) {
$val = $ENV{$var};
$val =~ s|\n|\n|g;
$val =~ s|"|\"|g;
print “${var}=”${val}"\n";

Not mission critical, but I am scratching my head to what I did wrong?


Probably suexec is complaining? There might be other causes as well. Have you checked this thread?

I did check owner permissions, as I had issues with suexec previously. I don’t believe that it to be the case here. Also I have FcgidIdleTimeout 3600 set as per the thread you pointed out. Unfortunately its still an internal server error.

Still working on this, thanks for your reply and help!

Where is your home directory for the web-users, is it /home or /var/www?

What path your suexec chroot compiled for?

Thanks Illia. I think there could be an issue here.

The default is /home for my webusers. However, I am wondering if I somehow disabled suexec now. I tried to run “suexec -V” as sudo and root and it couldn’t find it (Command ‘suexec’ not found). A “whereis suexec” revealed:

suexec: /usr/share/man/man8/suexec.8.gz

I did have suexec error a while ago because I had script owned by root, but I changed to the proper home owner and it was fine. I don’t remember changing anything in suexec itself.

Could you point me in the right direction - is there another way to test if suexec is running? Also below is the fcgi.conf in full, does this need to somehow call suexec? Let me know if there is anything else I can show that is helpful.

<IfModule mod_fcgid.c>
  FcgidConnectTimeout 20

  <IfModule mod_mime.c>
    AddHandler fcgid-script .fcgi 
	#these were added from stackexchange example
    FcgidIdleTimeout 3600
	FcgidIdleScanInterval 480
	FcgidBusyTimeout 1800
	FcgidBusyScanInterval 480
	FcgidZombieScanInterval 12
	FcgidErrorScanInterval 12