You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Eric Estes -=RCN Mail=- <e....@rcn.com> on 2002/04/30 08:48:59 UTC
Enabling CGI on Apache 1.3.23
I'm trying to get cgi to work on my Apache 1.3.23 Mandrake 8.2 computer.
I was told by someone on a forum to add this line to my httpd.conf file:
ScriptAlias /cgi-bin/ /var/www/cgi-bin/
I added the line and restarted Apache but it has not made any
difference. I can run cgi and perl scripts from the shell but I can run
them from a browser. I set the permissions correctly and even set them
to 777 just to make sure and they still can't be executed from a
browser.
If I type http://mithrilhall.redirectme.net/cgi-bin/test.cgi or
http://mithrilhall.redirectme.net/cgi-bin/test.pl I get back the
following message:
Forbidden
You don't have permission to access /cgi-bin/test.cgi on this server.
------------------------------------------------------------------------
--------
Apache-AdvancedExtranetServer/1.3.23 Server at Mithrilhall.Linux Port 80
If anyone can point me in the right direction I would greatly apprciate
it.
Eric
Mithrilhall's Linux Server
AMD-K2 350MHz
http://mithrilhall.redirectme.net
This email has been scanned with Norton AntiVirus
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: Enabling CGI on Apache 1.3.23
Posted by Jay Turberville <ja...@studio522.com>.
I could easily be wrong, but I don't think "EOF" be in quotes?
print <<"EOF";
should be <<EOF;
Jay Turberville
<snip>
> [Fri May 3 03:30:09 2002] [error] (2)No such file or directory: exec of
> /var/www/cgi-bin/test.pl failed
> [Fri May 3 03:30:09 2002] [error] [client 192.168.1.1] Premature end of
> script headers: /var/www/cgi-bin/test.pl
>
> This is a copy of the test.pl file I'm trying to run:
> **********************************************************
>
> #!/usr/bin/perl
>
> # hello.pl -- my first perl script!
>
> print "Content-type: text/html\n\n";
>
> print <<"EOF";
> <HTML>
>
> <HEAD>
> <TITLE>Hello, world!</TITLE>
> </HEAD>
>
> <BODY>
> <H1>Hello, world!</H1>
> </BODY>
>
> </HTML>
> EOF
>
> The script works fine when run from shell but can't be access from my
> website. Here is the error I get when I to run it from the browser:
> ************************************************************************
> *************************************************
> Internal Server Error
> The server encountered an internal error or misconfiguration and was
> unable to complete your request.
> Please contact the server administrator, root@localhost and inform them
> of the time the error occurred, and anything you might have done that
> may have caused the error.
>
> More information about this error may be available in the server error
> log.
>
>
>
> ------------------------------------------------------------------------
> --------
>
> Apache-AdvancedExtranetServer/1.3.23 Server at Mithrilhall.Linux Port 80
>
<snip>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
RE: Enabling CGI on Apache 1.3.23
Posted by Eric Estes -=RCN Mail=- <e....@rcn.com>.
Ok, I did /usr/bin/perl -v and got back:
************************************************************************
***
[root@Mithrilhall logs]# /usr/bin/perl -v
This is perl, v5.6.1 built for i386-linux
Copyright 1987-2001, Larry Wall
Perl may be copied only under the terms of either the Artistic License
or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using `man perl' or `perldoc perl'. If you have access to
the
Internet, point your browser at http://www.perl.com/, the Perl Home
Page.
I created a simple perl script with what you game me and put it in the
/var/www/cgi-bin/ directory and chmoded it to 777. It ran fine from
shell as shown below:
************************************************************************
***********************************************
[root@Mithrilhall cgi-bin]# perl simple.pl
Content-type: text/html\n\n
Hello world
[root@Mithrilhall cgi-bin]#
When attempting to run it from a browser I get the following error:
************************************************************************
************************************************
[Sat May 4 01:58:15 2002] [error] (2)No such file or directory: exec of
/var/www/cgi-bin/simple.pl failed
[Sat May 4 01:58:15 2002] [error] [client 192.168.1.1] Premature end of
script headers: /var/www/cgi-bin/simple.pl
I thank you for taking the time to give me a hand. This really has me
scratching my head.
Eric
-----Original Message-----
From: obo@bourse.ch [mailto:obo@bourse.ch]
Sent: May 3, 2002 1:45 AM
To: users@httpd.apache.org
Subject: Re: Enabling CGI on Apache 1.3.23
Eric Estes -=RCN Mail=- wrote:
>
> This is what I put in my httpd.conf file and then restarted httpd:
> *********************************************************************
>
> ScriptAlias /cgi-bin/ /var/www/cgi-bin/
>
> <Directory "/var/www/cgi-bin/">
> AllowOverride None
> Options Includes ExecCGI MultiViews FollowSymLinks
> Order allow,deny
> Allow from all
> </Directory>
This looks OK...
>
> This is what shows up in my error log:
> ***************************************
>
> [Fri May 3 03:30:09 2002] [error] (2)No such file or directory: exec
> of /var/www/cgi-bin/test.pl failed
This is a system-level error but the message can be confusing - at first
glance it looks like /var/www/cgi-bin/test.pl cannot be found - but I
bet you're certain it does exist. What the message is really saying is
that /usr/bin/perl cannot be found. That is, it loads the program then
tries to load the interpreter defined by the shebang line - but can't
find it. Read on...
> [Fri May 3 03:30:09 2002] [error] [client 192.168.1.1] Premature end
> of script headers: /var/www/cgi-bin/test.pl
This is the usual consequent error whenever anything goes wrong in CGI.
>
> This is a copy of the test.pl file I'm trying to run:
> **********************************************************
>
> #!/usr/bin/perl
>
> # hello.pl -- my first perl script!
>
> print "Content-type: text/html\n\n";
>
> print <<"EOF";
> <HTML>
>
> <HEAD>
> <TITLE>Hello, world!</TITLE>
> </HEAD>
>
> <BODY>
> <H1>Hello, world!</H1>
> </BODY>
>
> </HTML>
> EOF
Looks OK... Is perl really in /usr/bin/perl? Do "/usr/bin/perl -v" to
check.
>
> The script works fine when run from shell
Whoa! This is the acid-test. If it runs from the shell, then the shell
must be able to locate /usr/bin/perl. How come that the apache process
which loads it cannot? Are you really sure you are running
/var/www/cgi-bin/test.pl in your login shell and not a copy?
Try this even simpler script (don't forget to make it executable and
test it from the command line):
#!/bin/sh
echo "Content-type: text/html\n\n"
echo "Hello world"
If apache can't find /bin/sh then your in real trouble. If this works,
double-double check the location of perl. There is something funny about
your perl installation.
Rgds,
Owen Boyle.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: Enabling CGI on Apache 1.3.23
Posted by Owen Boyle <ob...@bourse.ch>.
Eric Estes -=RCN Mail=- wrote:
>
> This is what I put in my httpd.conf file and then restarted httpd:
> *********************************************************************
>
> ScriptAlias /cgi-bin/ /var/www/cgi-bin/
>
> <Directory "/var/www/cgi-bin/">
> AllowOverride None
> Options Includes ExecCGI MultiViews FollowSymLinks
> Order allow,deny
> Allow from all
> </Directory>
This looks OK...
>
> This is what shows up in my error log:
> ***************************************
>
> [Fri May 3 03:30:09 2002] [error] (2)No such file or directory: exec of
> /var/www/cgi-bin/test.pl failed
This is a system-level error but the message can be confusing - at first
glance it looks like /var/www/cgi-bin/test.pl cannot be found - but I
bet you're certain it does exist. What the message is really saying is
that /usr/bin/perl cannot be found. That is, it loads the program then
tries to load the interpreter defined by the shebang line - but can't
find it. Read on...
> [Fri May 3 03:30:09 2002] [error] [client 192.168.1.1] Premature end of
> script headers: /var/www/cgi-bin/test.pl
This is the usual consequent error whenever anything goes wrong in CGI.
>
> This is a copy of the test.pl file I'm trying to run:
> **********************************************************
>
> #!/usr/bin/perl
>
> # hello.pl -- my first perl script!
>
> print "Content-type: text/html\n\n";
>
> print <<"EOF";
> <HTML>
>
> <HEAD>
> <TITLE>Hello, world!</TITLE>
> </HEAD>
>
> <BODY>
> <H1>Hello, world!</H1>
> </BODY>
>
> </HTML>
> EOF
Looks OK... Is perl really in /usr/bin/perl? Do "/usr/bin/perl -v" to
check.
>
> The script works fine when run from shell
Whoa! This is the acid-test. If it runs from the shell, then the shell
must be able to locate /usr/bin/perl. How come that the apache process
which loads it cannot? Are you really sure you are running
/var/www/cgi-bin/test.pl in your login shell and not a copy?
Try this even simpler script (don't forget to make it executable and
test it from the command line):
#!/bin/sh
echo "Content-type: text/html\n\n"
echo "Hello world"
If apache can't find /bin/sh then your in real trouble. If this works,
double-double check the location of perl. There is something funny about
your perl installation.
Rgds,
Owen Boyle.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
RE: Enabling CGI on Apache 1.3.23
Posted by Eric Estes -=RCN Mail=- <e....@rcn.com>.
This is what I put in my httpd.conf file and then restarted httpd:
*********************************************************************
ScriptAlias /cgi-bin/ /var/www/cgi-bin/
<Directory "/var/www/cgi-bin/">
AllowOverride None
Options Includes ExecCGI MultiViews FollowSymLinks
Order allow,deny
Allow from all
</Directory>
This is what shows up in my error log:
***************************************
[Fri May 3 03:30:09 2002] [error] (2)No such file or directory: exec of
/var/www/cgi-bin/test.pl failed
[Fri May 3 03:30:09 2002] [error] [client 192.168.1.1] Premature end of
script headers: /var/www/cgi-bin/test.pl
This is a copy of the test.pl file I'm trying to run:
**********************************************************
#!/usr/bin/perl
# hello.pl -- my first perl script!
print "Content-type: text/html\n\n";
print <<"EOF";
<HTML>
<HEAD>
<TITLE>Hello, world!</TITLE>
</HEAD>
<BODY>
<H1>Hello, world!</H1>
</BODY>
</HTML>
EOF
The script works fine when run from shell but can't be access from my
website. Here is the error I get when I to run it from the browser:
************************************************************************
*************************************************
Internal Server Error
The server encountered an internal error or misconfiguration and was
unable to complete your request.
Please contact the server administrator, root@localhost and inform them
of the time the error occurred, and anything you might have done that
may have caused the error.
More information about this error may be available in the server error
log.
------------------------------------------------------------------------
--------
Apache-AdvancedExtranetServer/1.3.23 Server at Mithrilhall.Linux Port 80
-----Original Message-----
From: Alex Togstad [mailto:sniper@3dretreat.com]
Sent: April 30, 2002 1:03 AM
To: users@httpd.apache.org
Subject: Re: Enabling CGI on Apache 1.3.23
Under the Script Alias put this:
=========================================
<Directory "C:/var/www/cgi-bin/">
AllowOverride None
Options Includes ExecCGI MultiViews FollowSymLinks
Order allow,deny
Allow from all
</Directory>
=========================================
The above refers to if the cgi-bin was located on "C"
----- Original Message -----
From: "Eric Estes -=RCN Mail=-" <e....@rcn.com>
To: "Apache" <us...@httpd.apache.org>
Sent: Monday, April 29, 2002 11:48 PM
Subject: Enabling CGI on Apache 1.3.23
> I'm trying to get cgi to work on my Apache 1.3.23 Mandrake 8.2
> computer. I was told by someone on a forum to add this line to my
> httpd.conf file:
>
> ScriptAlias /cgi-bin/ /var/www/cgi-bin/
>
> I added the line and restarted Apache but it has not made any
> difference. I can run cgi and perl scripts from the shell but I can
> run them from a browser. I set the permissions correctly and even set
> them to 777 just to make sure and they still can't be executed from a
> browser.
>
> If I type http://mithrilhall.redirectme.net/cgi-bin/test.cgi or
> http://mithrilhall.redirectme.net/cgi-bin/test.pl I get back the
> following message:
>
> Forbidden
> You don't have permission to access /cgi-bin/test.cgi on this server.
>
>
> ----------------------------------------------------------------------
> --
> --------
>
> Apache-AdvancedExtranetServer/1.3.23 Server at Mithrilhall.Linux Port
> 80
>
>
> If anyone can point me in the right direction I would greatly
> apprciate it. Eric
>
>
> Mithrilhall's Linux Server
> AMD-K2 350MHz
> http://mithrilhall.redirectme.net
>
> This email has been scanned with Norton AntiVirus
>
>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server
> Project. See <URL:http://httpd.apache.org/userslist.html> for more
> info. To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server
Project. See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: Enabling CGI on Apache 1.3.23
Posted by Alex Togstad <sn...@3dretreat.com>.
Under the Script Alias put this:
=========================================
<Directory "C:/var/www/cgi-bin/">
AllowOverride None
Options Includes ExecCGI MultiViews FollowSymLinks
Order allow,deny
Allow from all
</Directory>
=========================================
The above refers to if the cgi-bin was located on "C"
----- Original Message -----
From: "Eric Estes -=RCN Mail=-" <e....@rcn.com>
To: "Apache" <us...@httpd.apache.org>
Sent: Monday, April 29, 2002 11:48 PM
Subject: Enabling CGI on Apache 1.3.23
> I'm trying to get cgi to work on my Apache 1.3.23 Mandrake 8.2 computer.
> I was told by someone on a forum to add this line to my httpd.conf file:
>
> ScriptAlias /cgi-bin/ /var/www/cgi-bin/
>
> I added the line and restarted Apache but it has not made any
> difference. I can run cgi and perl scripts from the shell but I can run
> them from a browser. I set the permissions correctly and even set them
> to 777 just to make sure and they still can't be executed from a
> browser.
>
> If I type http://mithrilhall.redirectme.net/cgi-bin/test.cgi or
> http://mithrilhall.redirectme.net/cgi-bin/test.pl I get back the
> following message:
>
> Forbidden
> You don't have permission to access /cgi-bin/test.cgi on this server.
>
>
> ------------------------------------------------------------------------
> --------
>
> Apache-AdvancedExtranetServer/1.3.23 Server at Mithrilhall.Linux Port 80
>
>
> If anyone can point me in the right direction I would greatly apprciate
> it.
> Eric
>
>
> Mithrilhall's Linux Server
> AMD-K2 350MHz
> http://mithrilhall.redirectme.net
>
> This email has been scanned with Norton AntiVirus
>
>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org