For Programmers: Free Programming Magazines  


Home > Archive > PERL CGI Beginners > July 2007 > cgi-bin will not execute perl program









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author cgi-bin will not execute perl program
Whitsey

2007-06-13, 7:55 am

I am trying to execute the printenv perl script in the cgi-bin
directory and it is printing the code instead of executing the
script. Normally this is prety basic stuff setting this up however I
just can't get it to work. I have gone through the Apache
documentation and performed everything to the letter and the feedback
there is if it still doesn't work, do it again... There are only so
many times you can do the exact same thing...

I can run the script from the command line as the httpd user so Perl
is installed and the script works fine.

Perl = /usr/bin/perl

ScriptAlias /cgi-bin/ "/usr/local/apache2.0.54/bindist/cgi-bin/"

<Directory "/usr/local/apache2.0.54/bindist/cgi-bin">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>

(NOTE: I tried adding a forward slash to the end of the Directory
value but to no effect)

[conf]# cat ../cgi-bin/printenv
#!/usr/bin/perl
##
## printenv -- demo CGI program which just prints its environment
##

print "Content-type: text/plain; charset=iso-8859-1\n\n";
foreach $var (sort(keys(%ENV))) {
$val = $ENV{$var};
$val =~ s|\n|\\n|g;
$val =~ s|"|\\"|g;
print "${var}=\"${val}\"\n";
}

I must be missing something but I can't for the life of me figure out
what it is???

Any help - please?

Mumia W.

2007-06-13, 7:55 am

On 06/12/2007 09:38 PM, whitsey wrote:
> [...]
> <Directory "/usr/local/apache2.0.54/bindist/cgi-bin">
> AllowOverride None
> Options None



You need "Options ExecCGI" or (more probably) "Options +ExecCGI"


Whitsey

2007-06-14, 7:55 am


Mumia W. wrote:
> On 06/12/2007 09:38 PM, whitsey wrote:
>
>
> You need "Options ExecCGI" or (more probably) "Options +ExecCGI"


The Apache/Tomcat documentation states that the "ScriptAlias"
directive automatically assigns the alias as a cgi-bin, therefore all
files within this directory are by default assigned as files to be
executed.

I did add this however is made no difference...

Mumia W.

2007-06-14, 9:55 pm

On 06/14/2007 02:24 AM, whitsey wrote:
> Mumia W. wrote:
>
> The Apache/Tomcat documentation states that the "ScriptAlias"
> directive automatically assigns the alias as a cgi-bin, therefore all
> files within this directory are by default assigned as files to be
> executed.
>
> I did add this however is made no difference...
>
>


You're right. Your configuration code (without +ExecCGI) worked on my
system (Apache2, Debian 3.1 i386), so I can't say why it doesn't work
for you.



Mike Williams

2007-06-14, 9:55 pm

On 6/14/07, Mumia W. <mumia.w.18.spam+nospam@earthlink.net> wrote:
> On 06/14/2007 02:24 AM, whitsey wrote:
>
> You're right. Your configuration code (without +ExecCGI) worked on my
> system (Apache2, Debian 3.1 i386), so I can't say why it doesn't work
> for you.
>


Interesting, I've been putting ExecCGI into options for years, thought
it was required.

Did some tinkering, commented out that option and Add-Handler which I
also thought was required and my cgi code still worked.

#Options ExecCGI
#AddHandler cgi-script .cgi

Then I found that if I commented out this line:

LoadModule cgi_module modules/mod_cgi.so

My cgi code no longer worked, it just displayed the source of my perl
code in the browser window.

Do you have a load module for mod_cgi in your httpd.conf file?

BTW - this was with Apache/2.2.4 on fedora 6.

Mike
Whitsey

2007-06-21, 7:55 am

On Jun 15, 6:20 am, drumm...@gmail.com (Mike Williams) wrote:
> On 6/14/07, Mumia W. <mumia.w.18.spam+nos...@earthlink.net> wrote:
>
>
>
>
>
>
>
>
>
>
> Interesting, I've been putting ExecCGI into options for years, thought
> it was required.
>
> Did some tinkering, commented out that option and Add-Handler which I
> also thought was required and my cgi code still worked.
>
> #Options ExecCGI
> #AddHandler cgi-script .cgi
>
> Then I found that if I commented out this line:
>
> LoadModule cgi_module modules/mod_cgi.so
>
> My cgi code no longer worked, it just displayed the source of my perl
> code in the browser window.
>
> Do you have a load module for mod_cgi in your httpd.conf file?
>
> BTW - this was with Apache/2.2.4 on fedora 6.
>
> Mike- Hide quoted text -
>
> - Show quoted text -


That is it!!! I can't beleive I didn't even check that. Assumed it
was a given that it would be there...

Ermoposterter

2007-07-15, 12:18 am

Sarah M. Gellar and Heather Locklear Licking Pussy Of Busty Blindfold Babe!
http://www.reyrewh.com/PlayMovie.asp?id=148803


extremely funny video george w bush funny video funny junk video really funny video clip very funny video
http://635-funny-video.info/crazy-e...unny-video.html http://635-funny-video.info/free-fu...o-to-watch.html http://635-funny-video.info/cartoon...-sex-video.html http://635-funny-video.info/funny-animal-video.html http://635-funny-video.info/funny-video-clip-site.html
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com