0

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:

#!/usr/bin/perl

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:

<VirtualHost 95.131.29.226:8080>
  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
  </Directory>

</VirtualHost>

fcgid.conf:

<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
</IfModule>

SuExec log:

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

Apache error log:

test!
test!
[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!

user38484
  • 313
  • 2
  • 5
  • 10

1 Answers1

0

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

perl -MCPAN -e 'install FCGI'
user38484
  • 313
  • 2
  • 5
  • 10
  • 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 06 '10 at 09:28