Perl CGI在浏览器中显示为文本

时间:2014-06-19 19:41:07

标签: apache perl cgi

Perl在浏览器中显示为文本。一切都是正确的。

perl文件的一部分。

#!/usr/bin/perl

...

# Write sendmailanalyzer header
print "Content-type: text/html\n\n";
print "<HTML><HEAD><TITLE>Environment Variables</TITLE></HEAD><BODY>";
$CGI->charset($CONFIG{HTML_CHARSET} || $DEFAULT_CHARSET);
print $CGI->header();
print $CGI->start_html(-title=>"sendmailanalyzer v$VERSION");

print qq{
        <!-- javascript to draw graphics -->
                <script type="text/javascript" src="$CONFIG{URL_JSCRIPT}"></script>
                <style type="text/css">
                <!--/* <![CDATA[ */
....and so on

的httpd.conf

        Alias /sareport /usr/local/something/www
        <Directory /usr/local/something/www>
                AddHandler cgi-script .cgi .pl
            Options FollowSymLinks +ExecCGI
                DirectoryIndex something.cgi
                Order deny,allow
                Deny from all
                Allow from 127.0.0.1
                Allow from ::1
                Allow from MyIP
        </Directory>

脚本设置为755 ...我迷失了这个。日志中没有任何内容。

直接从CLI运行应用程序会返回标题(它可以正常工作)

 Content-type: text/html

 <HTML><HEAD><TITLE>Environment Variables</TITLE></HEAD><BODY>Content-Type: text/html; charset=iso-8859-1

 <!DOCTYPE html
         PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US">
 <head>

1 个答案:

答案 0 :(得分:1)

我想通了,我正确地设置了cgi片段,但是有人已经注释掉了模块本身的实际负载

LoadModule cgi_module modules/mod_cgi.so
再见:}