GigaNews
View Full Version: FileSharing Talk

Threads in some sections have NO links for Guests, Register before you can view those threads or Log In now.
Your Ad Here

Pages: 1

Apache

(Click here to view the original thread with full colors/images)




Posted by: 4play

im trying to setup apache so i can use it to test cgi scripts in perl locally.

apache keeps showing me the scripts rather then executing them

#!/usr/bin/perl

print "Content-type:text/html\n\n";
print <<EndOfHTML;
<html><head><title>Print Environment</title></head>
<body>
EndOfHTML

foreach $key (sort(keys %ENV)) {
&nbsp; &nbsp;print "$key = $ENV{$key}<br>\n";
}

print "</body></html>";

that should work properly especially after i chmod 755. im guessing i have not setup apache properly and yes perl is installed and working ;)



Posted by: shn

pitty...............I was hoping some other linux user would help you. Guess we dont have many anymore <_<

You need to check your httpd.conf file. Apache is suppose to run the scripts right out the box provided you have the path to your perl interpreter in the httpd conf file. It actually looks for the default path of /usr/bin/perl anyway when the script is fired up. Looks like you have the path right but is it right in your httpd conf file?

Also check and see your not trying to run the script "outside" of your cgi directory. You need to tell apache to execute the file in the same pace you have the script ......usually that would be your cgi-bin directory if you put it there . B)

I think hax0r knows a thing or two about perl, cgi, etc, not sure :huh:



Posted by: h1

You might have more success by using ScriptAlias in your httpd.conf file instead of a module, but this poses a security risk.



Posted by: 4play

i remember i was following a guide to get cgi working and i have added something to scriptalias already. also all my cgi files are placed inside the cgi-bin.

better check my httpd.conf file again.



Posted by: cselik

<IfModule mod_userdir.c>
&nbsp; &nbsp;UserDir public_html
</IfModule>

<Directory /home/*/public_html>
&nbsp; &nbsp;AllowOverride none
&nbsp; &nbsp;Options MultiViews Indexes SymLinksIfOwnerMatch Includes ExecCgi
&nbsp; &nbsp;#Options All
&nbsp; &nbsp;#PerlSendHeader On
&nbsp; &nbsp;Addhandler cgi-script .cgi
...


i know i have been looking for the solution for 2 weeks.
i came up with the config above.
hope it helps.



Posted by: 4play

cheers cselik that worked a treat. :)






vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Limited.
vB Easy Archive Final ©2000 - 2008 - Created by Stefan "Xenon" Kaeser