TonyTakeshi
TonyTakeshi

Reputation: 5929

Perl not running

I have experience with setting up multiple Perl program with mac before, but come to a strange situation today.

I delete one of my existing Perl folder and download it from GitHub, when I try to run again, it shows this error: [an error occurred while processing this directive].

So, what I do to debug is:

1) I create test.shtml (some problem displaying the arrow sign in here)

#exec cgi="/Users/lion/htdocs/app/cgi-bin/test.pl"-->

2) I create test.pl

#!/usr/bin/perl
print "content-type: text/html \n\n";
print "test";

3) I create a new htaccess

AddType text/html .shtml
AddHandler server-parsed .shtml

4) I set the test.pl permission to 777

5) I tested with http://app.local/test.shtml -> come out error [an error occurred while processing this directive].

6) If I manually run from console, it is working fine.

Here's my apache config as well.

<VirtualHost *:80>
    DocumentRoot "/Users/lion/htdocs/app"
    ServerName app.local
    ScriptAlias /cgi-bin/ "/Users/lion/htdocs/app/cgi-bin/" 
</VirtualHost>

My apache error log show this:

[Wed Nov 09 16:45:25 2011] [error] [client 127.0.0.1] invalid CGI ref "/Users/lion/htdocs/app/cgi-bin/test.pl" in /Users/lion/htdocs/app/test.shtml

Not sure what I missed out, my other Perl program is running just fine. Run out of ideas what cause the problem.

Upvotes: 0

Views: 1230

Answers (2)

TonyTakeshi
TonyTakeshi

Reputation: 5929

Well, after spending sometime for debugging, found out the cause is a .htaccess with authentication in cgi-bin, it blocks the redirection.

Upvotes: 0

al.
al.

Reputation: 717

exec cgi expects a URL-path, not a file system path as an argument.

Try

#exec cgi="/cgi-bin/test.pl"

or just

#exec cgi="test.pl"

Upvotes: 3

Related Questions