-
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
Code:
#!/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)) {
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 ;)
-
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:
-
You might have more success by using ScriptAlias in your httpd.conf file instead of a module, but this poses a security risk.
-
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.
-
Code:
<IfModule mod_userdir.c>
UserDir public_html
</IfModule>
<Directory /home/*/public_html>
AllowOverride none
Options MultiViews Indexes SymLinksIfOwnerMatch Includes ExecCgi
#Options All
#PerlSendHeader On
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.
-
cheers cselik that worked a treat. :)