I'm trying to setup Apache2.2 with mod_fcgid and libapache2-mod-perl2 with no luck.

I've created a fcgi-bin directory in the root directory of my website and put there a test.fcgi file with the following content:


use CGI;

print "This is test.fcgi!\n";

While trying to access it via http://www.website.dom/fcgi-bin/test.fcgi I get error 500 (Internal Server Error).

Here is my vhost config:

  ServerName website.com
  DocumentRoot /var/www/data/website.com
  SuexecUserGroup user group 
  ServerAlias www.website.com
  AddType application/x-httpd-php .php .php3 .php4 .php5 .phtml

  <Directory "/var/www/data/website.com/fcgi-bin/">
    Options +ExecCGI
    Allow from all
    Order allow,deny
    AddHandler fcgid-script .fcgi



<IfModule mod_fcgid.c>
  AddHandler fcgid-script .fcgi
  SocketPath /var/lib/apache2/fcgid/sock
  IdleTimeout 3600
  ProcessLifeTime 7200
  MaxProcessCount 8
  DefaultMaxClassProcessCount 2
  IPCConnectTimeout 8
  IPCCommTimeout 60

SuExec log:

[2010-04-06 03:02:47]: uid: (500/equ) gid: (502/equ) cmd: test.fcgi

Apache error log:

[Tue Apr 06 03:02:51 2010] [notice] mod_fcgid: process /var/www/data/website.com/fcgi-bin/test.fcgi(26267) exit(communication error), terminated by calling exit(), return code: 0
[Tue Apr 06 03:02:53 2010] [notice] mod_fcgid: process /var/www/data/website.com/fcgi-bin/test.fcgi(26261) exit(server exited), terminated by calling exit(), return code: 0

I've no clue why I'm getting error 500, but when I'm trying to access this file using console ($ perl /var/www/data/website.com/fcgin-bin/test.fcgi) everthing works fine without any errors...

Any suggestions on how to solve this problem would be greatly appreciated.

Thank you!


The problem was I had to install Perl module for FastCGI with the following command:

perl -MCPAN -e 'install FCGI'
  • 2
    Not only install the module but also use it in your scripts. ;) Remember: The FastCGI protocol is different from the CGI protocol and you can't just run your ordinary CGI scripts as FastCGI.
    – joschi
    Apr 6 '10 at 9:28

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.