Running CGI With Perl under Apache Permission Problem

Posted by neversaint on Server Fault See other posts from Server Fault or by neversaint
Published on 2010-04-21T06:09:50Z Indexed on 2010/04/21 6:13 UTC
Read the original article Hit count: 526

Filed under:
|
|
|
|

I have the following entry under apache2.conf in my Debian box.

AddHandler cgi-script .cgi .pl
Options +ExecCGI
ScriptAlias /cgi-bin/ /var/www/mychosendir/cgi-bin/

Then I have a perl cgi script stored under these directories and permissions:

nvs@somename:/var/www/mychosendir$ ls -lhR 
.:
total 12K
drwxr-xr-x 2 nvs nvs 4.0K 2010-04-21 13:42 cgi-bin

./cgi-bin:
total 4.0K
-rwxr-xr-x 1 nvs nvs 90 2010-04-21 13:40 test.cgi

However when I tried to access it in the web browser:

http://myhost.com/mychosendir/cgi-bin/test.cgi

They gave me this error:

Forbidden

You don't have permission to access /mychosendir/cgi-bin/test.cgi on this server.

What's wrong with it?

Update:

I also have the following entry in my apache2.conf:

<Files ~ "^\.ht">
    Order allow,deny
    Deny from all
</Files>

© Server Fault or respective owner

Running CGI With Perl under Apache Permission Problem

Posted by neversaint on Server Fault See other posts from Server Fault or by neversaint
Published on 2010-04-21T13:39:27Z Indexed on 2010/04/21 13:43 UTC
Read the original article Hit count: 526

Filed under:
|
|

I have the following entry under apache2.conf in my Debian box.

AddHandler cgi-script .cgi .pl
Options +ExecCGI
ScriptAlias /mychosendir/cgi-bin/ /var/www/mychosendir/cgi-bin/


<Directory /var/www/mychosendir/cgi-bin>
Options +ExecCGI -Indexes
allow from all
</Directory>

Then I have a perl cgi script stored under these directories and permissions:

nvs@somename:/var/www/mychosendir$ ls -lhR 
.:
total 12K
drwxr-xr-x 2 nvs nvs 4.0K 2010-04-21 13:42 cgi-bin

./cgi-bin:
total 4.0K
-rwxr-xr-x 1 nvs nvs 90 2010-04-21 13:40 test.cgi

However when I tried to access it in the web browser:

http://myhost.com/mychosendir/cgi-bin/test.cgi

They gave me this error:

[Wed Apr 21 15:26:09 2010] [error] [client 150.82.219.158] (8)Exec format error: exec of '/var/www/mychosendir/cgi-bin/test.cgi' failed
[Wed Apr 21 15:26:09 2010] [error] [client 150.82.219.158] Premature end of script headers: test.cgi

What's wrong with it?

Update:

I also have the following entry in my apache2.conf:

<Files ~ "^\.ht">
    Order allow,deny
    Deny from all
</Files>

And the content of test.cgi is this:

#!/usr/bin/perl -wT
print "Content-type: text/html\n\n";
print "Hello, world!\n";

© Server Fault or respective owner

Running CGI With Perl under Apache Permission Problem

Posted by neversaint on Stack Overflow See other posts from Stack Overflow or by neversaint
Published on 2010-04-21T05:50:18Z Indexed on 2010/04/21 5:53 UTC
Read the original article Hit count: 526

Filed under:
|
|
|
|

I have the following entry under apache2.conf in my Debian box.

AddHandler cgi-script .cgi .pl
Options +ExecCGI
ScriptAlias /cgi-bin/ /var/www/mychosendir/cgi-bin/

Then I have a perl cgi script stored under these directories and permissions:

nvs@somename:/var/www/mychosendir$ ls -lhR 
.:
total 12K
drwxr-xr-x 2 nvs nvs 4.0K 2010-04-21 13:42 cgi-bin

./cgi-bin:
total 4.0K
-rwxr-xr-x 1 nvs nvs 90 2010-04-21 13:40 test.cgi

However when I tried to access it in the web browser:

http://myhost.com/mychosendir/cgi-bin/test.cgi

They gave me this error:

Forbidden

You don't have permission to access /mychosendir/cgi-bin/test.cgi on this server.

What's wrong with it?

© Stack Overflow or respective owner

Running CGI With Perl under Apache Permission Problem

Posted by neversaint on Server Fault See other posts from Server Fault or by neversaint
Published on 2010-04-21T05:50:18Z Indexed on 2010/04/21 13:43 UTC
Read the original article Hit count: 526

Filed under:
|
|

I have the following entry under apache2.conf in my Debian box.

AddHandler cgi-script .cgi .pl
Options +ExecCGI
ScriptAlias /cgi-bin/ /var/www/mychosendir/cgi-bin/

<Directory /var/www/mychosendir/cgi-bin>
Options +ExecCGI -Indexes
allow from all
</Directory>

Then I have a perl cgi script stored under these directories and permissions:

nvs@somename:/var/www/mychosendir$ ls -lhR 
.:
total 12K
drwxr-xr-x 2 nvs nvs 4.0K 2010-04-21 13:42 cgi-bin

./cgi-bin:
total 4.0K
-rwxr-xr-x 1 nvs nvs 90 2010-04-21 13:40 test.cgi

However when I tried to access it in the web browser:

http://myhost.com/mychosendir/cgi-bin/test.cgi

They gave me this error:

[Wed Apr 21 15:26:09 2010] [error] [client 150.82.219.158] (8)Exec format error: exec of '/var/www/mychosendir/cgi-bin/test.cgi' failed
[Wed Apr 21 15:26:09 2010] [error] [client 150.82.219.158] Premature end of script headers: test.cgi

What's wrong with it?

Update:

I also have the following entry in my apache2.conf:

<Files ~ "^\.ht">
    Order allow,deny
    Deny from all
</Files>

And the content of test.cgi is this:

#!/usr/bin/perl -wT
print "Content-type: text/html\n\n";
print "Hello, world!\n";

© Server Fault or respective owner

Related posts about apache

Related posts about httpd