Perl and FastCGI, can't get it to work


#1

I’m can’t seem to get Perl and FastCGI to work. My script is the basic helloworld script on the wiki:
#!/usr/bin/perl

use lib qw( /home/myusername/local/lib/perl/5.8.8 );
use FCGI;
use Socket qw( :crlf ); # server agnostic line endings in $CRLF

my $counter = 0;
while ( FCGI::accept() >= 0 ) {
$counter++;

print
"Content-Type: text/plain",
$CRLF,
$CRLF,
“Hello World, in Perl FastCGI!”,
$CRLF,
“I am process $$.”,
$CRLF,
“I have served $counter request(s).”,
$CRLF;
}

The script runs fine if I try to just run it. My .htaccess file looks like this:
Options +ExecCGI
AddHandler fastcgi-script .fcgi

RewriteEngine On
RewriteRule ^(test/script/dispatch.fcgi/.)$ - [L]
RewriteRule ^(.
)$ test/script/dispatch.fcgi/$1 [PT,L]

But, but whenver I visit my domain I get these (not very helpful) error messages in my error.log:
[Sat Jul 26 16:07:01 2008] [error] [client 12.216.230.180] FastCGI: comm with (dynamic) server “/mnt/local/home/myusername/catalyst-test.mydomain.com/test/script/dispatch.fcgi” aborted: (first read) idle timeout (60 sec)
[Sat Jul 26 16:07:01 2008] [error] [client 12.216.230.180] FastCGI: incomplete headers (0 bytes) received from server “/mnt/local/home/myusername/catalyst-test.mydomain.com/test/script/dispatch.fcgi”

Any ideas or troubleshooting tips?


#2

Well, I got it working. My current solution (or workaround) is to move my dispatch.fcgi script up to the root of the domain. So my .htaccess file now reads like this:

Options +ExecCGI
AddHandler fastcgi-script .fcgi

RewriteEngine On
RewriteRule ^(dispatch.fcgi/.)$ - [L]
RewriteRule ^(.
)$ dispatch.fcgi/$1 [QSA,L]

I’m not really sure why I needed to do this, I assume its because some part of my RewriteRules are incorrect, but it works.


#3

You can turn on FastCGI support via DH panel --> Domains --> Manage Domains --> Web Hosting --> Edit

Well it is same if you manually add .htaccess file.

$50 off and 3 free domains with code: [color=#CC0000]DH3[/color] Sign Up NOW or More Codes Here