You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by awongxi <ac...@accefyn.org.co> on 2003/07/26 12:21:46 UTC

[users@httpd] newest to apache

Sorry this may seem as a really newbi question but... I have lost lots 
of time trying to fix this and nothing works...
I am running apache under redhat linux. the html folder with the html 
files is at /var/www/html and the cgi is at /var/www/cgi-bin
I have a simple script (perl script) that I took from the web, the perl 
path is ok, and it works when I run it on command line... well I Would 
like to see this script working via a browser so I place the script 
under /var/www/html and chmod 755 to it. well the localhost/hello.pl and 
it displays the text, the source code, ok then I rename the file as 
hello.cgi and try again and the same result...

#! /usr/bin/perl

#!/usr/local/bin/perl
# hello.pl - My first CGI program

print "Content-Type: text/html\n\n";
# Note there is a newline between 
# this header and Data

# Simple HTML code follows

print "<html> <head>\n";
print "<title>Hello, world!</title>";
print "</head>\n";
print "<body>\n";
print "<h1>Hello, world!</h1>\n";
print "</body> </html>\n";

tha is my simple script... as I sayed beore it works on command line. as cgi and as pl I have tryed. when I check the apache log file:

it does not generate an error msg, well any way the file is being displyed as text.. so... what am I doing wrong... 
how can I see this simple perl script working? is there anything at the http.conf file I should check? does it have to do with the mod_perl? if so how to activate it? please please just this simele thing.. please






---------------------------------------------------------------------
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
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] newest to apache

Posted by DvDmanDT <dv...@telia.com>.
Except that the cgi-bin folder accutually is an alias, ScriptAlias, and
therefore it doesn't need ExecCGI even if it has the same functionality...

In httpd.conf you must also search for something like
#AddHandler cgi-script .cgi
and you must remov the # and add .pl at the end... THEN add
Options ExecCGI
to the folder where you need it... I did it like this:

    LoadFile "D:\Srv\Apache\mod_perl-1.3\Perl\bin\perl56.dll"
    LoadModule perl_module modules/mod_perl.so
    AddHandler cgi-script .cgi
    <IfModule mod_perl.c>
    PerlModule Apache::Registry
    PerlSendHeader On
    <Files *.pl>
    SetHandler perl-script
    PerlHandler Apache::Registry
    Options ExecCGI
    </Files>
    <Files *.cgi>
    #SetHandler perl-script     #Uncomment this and next line to get .cgi's
handled by mod_perl
    #PerlHandler Apache::Registry
    Options +ExecCGI
    </Files>
    </IfModule>

To make .pl files get handled as CGI's, comment out these lines:
    PerlModule Apache::Registry
    PerlSendHeader On
and
    SetHandler perl-script
    PerlHandler Apache::Registry

Also, change
AddHandler cgi-script .cgi
to
AddHandler cgi-script .cgi .pl

// DvDmanDT
MSN: dvdmandt@hotmail.com
Mail: dvdmandt@telia.com
----- Original Message ----- 
From: "Brian Dessent" <br...@dessent.net>
To: <us...@httpd.apache.org>
Sent: Saturday, July 26, 2003 12:40 PM
Subject: Re: [users@httpd] newest to apache


> awongxi wrote:
>
> > path is ok, and it works when I run it on command line... well I Would
> > like to see this script working via a browser so I place the script
> > under /var/www/html and chmod 755 to it. well the localhost/hello.pl
>
> Move the script to the cgi-bin directory, or enable ExecCGI for the
> directory the script is in.  Apache won't run scripts in a directory
> without this option enabled.  Somewhere in your httpd.conf, there's
> probably a section similar to
>
> <Directory "/var/www/html">
>     ...
>     Options Indexes FollowSymLinks MultiViews
>     ...
> </Directory>
>
> You must add "ExecCGI" to this list of options, or just move the script
> from the cgi-bin directory (which likely already has ExecCGI enabled.)
>
> Brian
>
> ---------------------------------------------------------------------
> 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
>    "   from the digest: users-digest-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
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] newest to apache

Posted by Brian Dessent <br...@dessent.net>.
awongxi wrote:

> path is ok, and it works when I run it on command line... well I Would
> like to see this script working via a browser so I place the script
> under /var/www/html and chmod 755 to it. well the localhost/hello.pl 

Move the script to the cgi-bin directory, or enable ExecCGI for the
directory the script is in.  Apache won't run scripts in a directory
without this option enabled.  Somewhere in your httpd.conf, there's
probably a section similar to

<Directory "/var/www/html">
    ...
    Options Indexes FollowSymLinks MultiViews
    ...
</Directory>

You must add "ExecCGI" to this list of options, or just move the script
from the cgi-bin directory (which likely already has ExecCGI enabled.)

Brian

---------------------------------------------------------------------
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
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org