Hi,
I have a problem getting perl to work with apache. I have googled
and can get no solution.
Php works fine having created "phpinfo.php" and chmod 755
/var/www/html/phpinfo.php.
Then http://localhost/phpinfo.php gives me the Php Version 5.1.4
page. OK
I have created printenv.pl :
#!/usr/bin/perl
##
## printenv -- demo CGI program which just prints its environment
##
print "Content-type: text/plain\n\n";
foreach $var (sort(keys(%ENV))) {
$val = $ENV{$var};
$val =~ s|\n|\\n|g;
$val =~ s|"|\\"|g;
print "${var}=\"${val}\"\n";
}
Then chmod 755 /var/www/html/printenv.pl
http://localhost/printenv.pl gives me:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>500 Internal Server Error</title>
</head><body>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error or
misconfiguration and was unable to complete
your request.</p>
<p>Please contact the server administrator,
david at epoc.ie and inform them of the time the error occurred,
and anything you might have done that may have
caused the error.</p>
<p>More information about this error may be available
in the server error log.</p>
<p>Additionally, a 500 Internal Server Error
error was encountered while trying to use an ErrorDocument to handle the
request.</p>
<hr>
<address>Apache/2.2.0 (Fedora) Server at www.epoc.ie Port 80</address>
</body></html>
running perl /var/www/html/printenv.pl as user outputs all the env
variables in plain text
Examining the apache logs gives:
(13) Permission denied: exec of '/var/www/html/printenv.pl'
Premature end of script headers: printenv.pl
But I think I have the permissions set correctly : chmod 755
/var/www/html/printenv.pl
AddHandler in apache config is: Addhandler cgi-script .cgi .pl
and the "options" line is : Options Indexes Includes FollowSymLinks
SymLinksifOwnerMatch ExecCGI MultiViews
What have I done wrong? Could anyone help me out .
David
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!