I'm trying to get an old Perl script running again after installing mod_fcgid. I had to install mod_fcgid for a new client, but it seems to have broken some of my other cgi scripts.

When going to the page, its now a 500 error. I checked the error log, and the output from the script is in the error log... so the script is running but for some reason it still delivers a 500 Internal Server Error to the browser...

HTML headers are the first thing printed... so I'm not really sure why this error is occurring.

The Error Log:

[omitted:html output]
[Wed Dec 08 08:59:18 2010] [warn] (104)Connection reset by peer: mod_fcgid: read data from fastcgi server error.
[Wed Dec 08 08:59:18 2010] [error] [client x.x.x.x] Premature end of script headers: www_protect.cgi, referer: http://www.mywebsite.net/
[Wed Dec 08 08:59:21 2010] [notice] mod_fcgid: process /www/sites/somescript.cgi(6747) exit(communication error), terminated by calling exit(), return code: 0


  AddHandler fcgid-script .fcgi .cgi
  #SocketPath /var/lib/apache2/fcgid/sock
  IPCConnectTimeout 45
  IPCCommTimeout 20
  OutputBufferSize 0
  MaxRequestsPerProcess 500
  IdleTimeout 3600
  ProcessLifeTime 7200
  MaxProcessCount 8
  DefaultMaxClassProcessCount 2

# Sane place to put sockets and shared memory file
SocketPath /var/run/mod_fcgid
SharememPath /var/run/mod_fcgid/fcgid_shm

Your configuration is telling Apache to serve all CGI scripts under FastCGI, which isn't possible. FastCGI isn't directly compatible with CGI scripts.

You should move the AddHandler directive into your client's VirtualHost, so it doesn't apply to the whole configuration, e.g.

<VirtualHost *:80>
    ServerName clienthost.com
    AddHandler fcgid-script .fcgi .cgi

If your client's scripts are on the same VirtualHost as your other cgi scripts, you can restrict the FastCGI handling to a specific Location or Directory, e.g.

<Location /clientarea>
    AddHandler fcgid-script .fcgi .cgi

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.