perl - 我的浏览器显示 perl.cgi 脚本的内容而不是执行?

标签 perl apache firefox slackware

我最近使用 slackpkg 更新了我的 Slackware13.37,现在 Firefox 显示我的 perl.cgi 脚本的内容而不是执行。 我正在使用:

bash-4.2# httpd -v 
Server version: Apache/2.4.2 (Unix) Server built: May 24 2012 14:55:44
bash-4.2# firefox -v 
Mozilla Firefox 12.0
bash-4.2# perl -v 
This is perl 5, version 16, subversion 0 (v5.16.0) built for i486-linux-thread-multi

脚本在更新之前有效

#!/usr/bin/perl -w

use strict;
use warnings;
use CGI;
use DBI;
use PDF::API2::Simple;
use PDF::Table;
use Data::Types qw(:all);

my @param=();
###############################
###          main          ####
###############################
my $q = new CGI;
if(!defined $q->param('login')){
    if(!defined $q->param('query')){main::login_relogin('Welcome');
    }else{
    my ($fname,$lname,$sec,$w,$h) = main::read_cookie();
    if(defined $sec){
        main::home($fname,$lname,$sec,$w,$h,$q->param('query'),$q->param('param1'),$q->param('param2'));
    }else{main::login_relogin('Your session expired !!!');}
    }
etc... etc...

请帮忙

最佳答案

我在使用 Apache 2.4.2 时也遇到了同样的问题。

问题已解决:mod_cgi.so 默认情况下不会在我的系统 (openSUSE 12.1) 上构建。当我构建 Apache 2.2 时,CGI 是核心的一部分,而不是像 2.4 中那样是动态模块。所以在运行configure时,需要添加--enable-cgi。另外,在 httpd.conf 中取消注释“LoadModule dir_modulemodules/mod_cgi.so”

或者,使用 mod_cgid.so,它是在我的系统上构建的。每http://httpd.apache.org/docs/current/mod/mod_cgi.html

“在unix下使用多线程MPM时,应该使用模块mod_cgid来代替该模块。在用户级别,这两个模块本质上是相同的”

因此,取消 httpd.conf 中“LoadModule dir_modulemodules/mod_cgid.so”的注释。还要取消 httpd.conf 中“Scriptsock logs/cgisock”的注释(在指令中)。

关于perl - 我的浏览器显示 perl.cgi 脚本的内容而不是执行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10835436/

相关文章:

xml - Perl XML 获取同一父项的子项详细信息

Perl DBIx::Class DateTime 减法

javascript - 混淆/缩小动态生成的 javascript 的最佳方法是什么

javascript - 是否可以在插件中控制 Firefox 的 DNS 请求?

html - 为什么 fixed navigation box-shadow 在 Firefox 和 IE 中不能正常显示?

css - 与 Chrome 中的预期结果相比,Firefox 中的奇怪 CSS 结果(一些 div 未对齐但向下移动)

database - 无法连接到 Postgres

javascript - 在 JavaScript 中访问 Perl 数组

apache - JMeter 未知参数 ?t

java - 使用jsp和servlet上传文件