繁体   English   中英

Perl Apache问题

[英]Perl Apache Issue

我似乎甚至无法解决此问题,我已经尝试了很多事情,但没有任何效果。

我基本上是为我的一个朋友做的,我已经在他的ubuntu服务器中正确设置了apache,但是每当我尝试访问usr/lib/cgi-bin的注册文件时,它总是给我500内部服务器错误。

这是站点配置文件(000-default.conf)

<VirtualHost *:80>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
 AllowOverride None
 Options +ExecCGI -MultiViews      +SymLinksIfOwnerMatch
 Order allow,deny
 Allow from all
 </Directory>

# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com

ServerAdmin webmaster@localhost
DocumentRoot /var/www/html

# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
    </VirtualHost>

    # vim: syntax=apache ts=4 sw=4 sts=4 sr noet

这是注册文件:

  #!/usr/bin/perl

  use strict;
  use warnings;

  use CGI;
  use Method::Signatures;
  use Digest::MD5 qw(md5_hex);
  use Drivers::MySQL;
  use feature qw(say);

  print header();

  my %arrConfig = (
          dbHost => '127.0.0.1',
          dbName => 'Luna',
          dbUser => 'root',
          dbPass => 'password123'
  );

  my $objHtml = CGI->new;
  my $objMysql = MySQL->new;

  $objMysql->createMysql($arrConfig{dbHost}, $arrConfig{dbName}, $arrConfig{dbUser}, $arrConfig{dbPass});

  if ($objHtml->param) {
     parseResults(\%arrConfig, $objMysql, $objHtml);
  } else {
    displayPage(\%arrConfig, $objHtml);
  }

  method parseResults(\%arrConfig, $objMysql, $objHtml) {
   my $strName = $objHtml->param('username');
   my $strPass = $objHtml->param('password');
   my $strPassTwo = $objHtml->param('passwordtwo');
   my $intColour = $objHtml->param('colour');
   my $strIP = $objHtml->remote_host;

   my $intNameCount = $objMysql->countRows("SELECT `username` FROM users WHERE `username` = '$strName'");
   my $intIPCount = $objMysql->countRows("SELECT `ipAddr` FROM users WHERE `ipAddr` = '$strIP'");

   if ($intIPCount > 2) {
       error('You Can Only Own Two Accounts Per IP Address');
   } elsif (!$strName && !$strPass && !$strPassTwo && !$intColour) {
       error('You Did Not Complete All The Fields! Please Try Again');
   } elsif ($strName !~ /^[a-zA-Z0-9]+$/) {
       error('Username Is Invalid');
   } elsif ($strName > 12 && $strName < 3) {
       error('Username Contains Too Many Or Less Characters');
   } elsif ($intNameCount > 0) {
       error('Username Already Exists');
   } elsif (length($strPass) > 20 && length($strPass) <= 5) {
       error('Password Contains Too Many Or Less Characters');
   } elsif ($strPass ne $strPassTwo) {
       error('Password Does Not Match');
   } elsif ($strPass !~ /^(?=.{5,10}$)(?=.*?[A-Z])(?=.*?\d)(?=.*[@#*=])(?!.*\s+)/) {
       error('Password Requires One Uppercase, Lowercase, Integer And Special Character');
   } elsif (!int($intColour) && $intColour > 15 && $intColour < 0) {
       error('Invalid Colour');
   }

   my $strHash = md5_hex($strPass);

   my $intID = $objMysql->insertData('users', ['nickname', 'username', 'password', 'colour', 'active', 'ipAddr', 'stamps'], [$strName, $strName, $strHash, $intColour, 1, $strIP, '31|7|33|8|32|35|34|36|290|358|448']);

   $objMysql->insertData('igloos', ['ID', 'username'], [$intID, $strName]);
   $objMysql->insertData('postcards', ['recepient', 'mailerName', 'mailerID', 'notes', 'postcardType', 'timestamp'], [$intID, 'Luna', 0, 'Welcome To Luna!', 125, time]);

   say $objHtml->h1('You have successfully registered');
   say $objHtml->p($objHtml->u('Your account details:'));
   say 'Username: ' . $objHtml->b($strName);
   say 'Password: ' . $objHtml->b($strPass);
   say 'ID: ' . $objHtml->b($intID);
  }

  method displayPage(\%arrConfig, $objHtml) {       
   say $objHtml->start_html(-title => 'Luna', -bgcolor => 'white');
   say $objHtml->start_center;
   say $objHtml->start_form(-name => 'main', -method => 'POST');
   say $objHtml->start_table;

   my %arrColours = (
                  1 => 'Blue', 
                  2 => 'Green',
                  3 => 'Pink',
                  4 => 'Black',
                  5 => 'Red',
                  6 => 'Orange',
                  7 => 'Yellow', 
                  8 => 'Dark Purple',
                  9 => 'Brown',
                  10 => 'Peach',
                  11 => 'Dark Green', 
                  12 => 'Light Blue',
                  13 => 'Light Green',
                  14 => 'Gray', 
                  15 => 'Aqua'
   );

   say $objHtml->Tr($objHtml->td('Username:'), $objHtml->td($objHtml->textfield(-placeholder => 'Enter your name', -type => 'text', -name => 'username', -maxlength => 12)));
   say $objHtml->Tr($objHtml->td('Password:'), $objHtml->td($objHtml->textfield(-placeholder => 'Enter your password', -type => 'password', -name => 'password', -maxlength => 20)));
   say $objHtml->Tr($objHtml->td('Repeat Password:'), $objHtml->td($objHtml->textfield(-placeholder => 'Enter your password again', -type => 'password', -name => 'passwordtwo', -maxlength => 20)));
   say $objHtml->Tr($objHtml->td('Colour:'), $objHtml->td($objHtml->popup_menu(-name   => 'colour', -values => [sort keys %arrColours], -labels => \%arrColours)));

   say $objHtml->Tr($objHtml->td($objHtml->submit(-value => 'Submit')));
   say $objHtml->end_table;
   say $objHtml->end_form;
   say $objHtml->end_center;
   say $objHtml->end_html;
 }

 method error($strError) {
   my $strBoldError = $objHtml->b($strError);
   my $strErrorStatement = $objHtml->p($strBoldError);
   say $strErrorStatement;
   exit;
 }

我已将文件权限更改为755,并检查了语法及其所有内容。

有没有我看不到的东西吗? 错误日志显示的全部是“脚本输出在标头之前结束”。

错误日志:

根据请求的错误日志:

[Thu Dec 24 02:56:38.929902 2015] [mpm_event:notice] [pid 15417:tid 140140605220736] AH00489: Apache/2.4.7 (Ubuntu) configured -- resuming normal operations
[Thu Dec 24 02:56:38.929965 2015] [core:notice] [pid 15417:tid 140140605220736] AH00094: Command line: '/usr/sbin/apache2'
[Thu Dec 24 02:59:21.946307 2015] [mpm_event:notice] [pid 15417:tid 140140605220736] AH00491: caught SIGTERM, shutting down
[Thu Dec 24 02:59:22.986351 2015] [mpm_event:notice] [pid 15569:tid 139751035283328] AH00489: Apache/2.4.7 (Ubuntu) configured -- resuming normal operations
[Thu Dec 24 02:59:22.986419 2015] [core:notice] [pid 15569:tid 139751035283328] AH00094: Command line: '/usr/sbin/apache2'
[Thu Dec 24 03:06:59.763950 2015] [cgid:error] [pid 15574:tid 139750820263680] [client 106.208.29.16:26368] AH01265: attempt to invoke directory as script: /usr/lib/cgi-bin/
[Thu Dec 24 03:43:57.494621 2015] [mpm_event:notice] [pid 15569:tid 139751035283328] AH00491: caught SIGTERM, shutting down
[Thu Dec 24 03:43:58.542633 2015] [mpm_event:notice] [pid 18173:tid 140578810890112] AH00489: Apache/2.4.7 (Ubuntu) configured -- resuming normal operations
[Thu Dec 24 03:43:58.542713 2015] [core:notice] [pid 18173:tid 140578810890112] AH00094: Command line: '/usr/sbin/apache2'
[Thu Dec 24 03:44:24.357114 2015] [cgid:error] [pid 18177:tid 140578633279232] [client 106.208.31.1:1569] AH01264: script not found or unable to stat: /var/www/cgi-bin/egister
[Thu Dec 24 03:44:43.672738 2015] [cgid:error] [pid 18235:tid 140578810890112] (13)Permission denied: AH01241: exec of '/var/www/cgi-bin/register/index.pl' failed
[Thu Dec 24 03:44:43.672938 2015] [cgid:error] [pid 18177:tid 140578599708416] [client 106.208.31.1:1591] End of script output before headers: index.pl
Can't locate Drivers/MySQL.pm in @INC (you may need to install the Drivers::MySQL module) (@INC contains: /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at /var/www/cgi-bin/register/index.pl line 11.
BEGIN failed--compilation aborted at /var/www/cgi-bin/register/index.pl line 11.
[Thu Dec 24 03:46:39.938441 2015] [cgid:error] [pid 18177:tid 140578507388672] [client 106.208.31.1:1635] End of script output before headers: index.pl
Can't locate Drivers/MySQL.pm in @INC (you may need to install the Drivers::MySQL module) (@INC contains: /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at /var/www/cgi-bin/register/index.pl line 11.
BEGIN failed--compilation aborted at /var/www/cgi-bin/register/index.pl line 11.
[Thu Dec 24 03:46:44.769191 2015] [cgid:error] [pid 18178:tid 140578448639744] [client 106.208.31.1:1645] End of script output before headers: index.pl
Can't locate Data/Alias.pm in @INC (you may need to install the Data::Alias module) (@INC contains: /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at /usr/local/share/perl/5.18.2/Method/Signatures.pm line 980.
Compilation failed in require at /var/www/cgi-bin/register/index.pl line 11.
BEGIN failed--compilation aborted at /var/www/cgi-bin/register/index.pl line 11.
[Thu Dec 24 03:54:02.681970 2015] [cgid:error] [pid 18178:tid 140578557744896] [client 106.208.31.1:1836] End of script output before headers: index.pl
Can't locate Data/Alias.pm in @INC (you may need to install the Data::Alias module) (@INC contains: /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at /usr/local/share/perl/5.18.2/Method/Signatures.pm line 980.
Compilation failed in require at /var/www/cgi-bin/register/index.pl line 11.
BEGIN failed--compilation aborted at /var/www/cgi-bin/register/index.pl line 11.
[Thu Dec 24 03:54:13.856406 2015] [cgid:error] [pid 18177:tid 140578574530304] [client 106.208.31.1:1856] End of script output before headers: index.pl
[Thu Dec 24 03:59:20.898641 2015] [cgid:error] [pid 18178:tid 140578566137600] [client 106.208.31.1:1984] AH01264: script not found or unable to stat: /var/www/cgi-bin/register/register.pl
[Thu Dec 24 04:00:38.302010 2015] [cgid:error] [pid 19584:tid 140578810890112] (13)Permission denied: AH01241: exec of '/var/www/cgi-bin/register/register.pl' failed
[Thu Dec 24 04:00:38.302221 2015] [cgid:error] [pid 18178:tid 140578507388672] [client 106.208.31.1:2004] End of script output before headers: register.pl
[Thu Dec 24 04:01:01.468669 2015] [cgid:error] [pid 19585:tid 140578810890112] (13)Permission denied: AH01241: exec of '/var/www/cgi-bin/register/register.pl' failed
[Thu Dec 24 04:01:01.468947 2015] [cgid:error] [pid 18177:tid 140578448639744] [client 106.208.31.1:2017] End of script output before headers: register.pl
[Thu Dec 24 04:14:40.401399 2015] [cgid:error] [pid 19929:tid 140578810890112] (13)Permission denied: AH01241: exec of '/var/www/cgi-bin/register/register.pl' failed
[Thu Dec 24 04:14:40.401631 2015] [cgid:error] [pid 18177:tid 140578473817856] [client 106.208.88.238:21256] End of script output before headers: register.pl
[Thu Dec 24 04:15:11.473083 2015] [cgid:error] [pid 19932:tid 140578810890112] (13)Permission denied: AH01241: exec of '/var/www/cgi-bin/register/register.pl' failed
[Thu Dec 24 04:15:11.473309 2015] [cgid:error] [pid 18177:tid 140578448639744] [client 106.208.88.238:21259] End of script output before headers: register.pl
[Thu Dec 24 04:15:29.327062 2015] [cgid:error] [pid 19933:tid 140578810890112] (13)Permission denied: AH01241: exec of '/var/www/cgi-bin/register/register.pl' failed
[Thu Dec 24 04:15:29.327299 2015] [cgid:error] [pid 18178:tid 140578515781376] [client 106.208.88.238:21261] End of script output before headers: register.pl
Can't locate Data/Alias.pm in @INC (you may need to install the Data::Alias module) (@INC contains: /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at /usr/local/share/perl/5.18.2/Method/Signatures.pm line 980.
Compilation failed in require at /var/www/cgi-bin/register/index.pl line 11.
BEGIN failed--compilation aborted at /var/www/cgi-bin/register/index.pl line 11.
[Thu Dec 24 04:26:55.088334 2015] [cgid:error] [pid 18177:tid 140578507388672] [client 106.208.88.238:21429] End of script output before headers: index.pl
Global symbol "$objHtml" requires explicit package name at /var/www/cgi-bin/register/register.pl line 9.
Global symbol "$arrConfig" requires explicit package name at /var/www/cgi-bin/register/register.pl line 10.
Global symbol "$objMysql" requires explicit package name at /var/www/cgi-bin/register/register.pl line 10.
Global symbol "$objCaptcha" requires explicit package name at /var/www/cgi-bin/register/register.pl line 10.
Global symbol "$objHtml" requires explicit package name at /var/www/cgi-bin/register/register.pl line 10.
Global symbol "$arrConfig" requires explicit package name at /var/www/cgi-bin/register/register.pl line 12.
Global symbol "$objCaptcha" requires explicit package name at /var/www/cgi-bin/register/register.pl line 12.
Global symbol "$objHtml" requires explicit package name at /var/www/cgi-bin/register/register.pl line 12.
Global symbol "$arrConfig" requires explicit package name at /var/www/cgi-bin/register/register.pl line 15.
Global symbol "$objMysql" requires explicit package name at /var/www/cgi-bin/register/register.pl line 15.
Global symbol "$objCaptcha" requires explicit package name at /var/www/cgi-bin/register/register.pl line 15.
Global symbol "$objHtml" requires explicit package name at /var/www/cgi-bin/register/register.pl line 15.
syntax error at /var/www/cgi-bin/register/register.pl line 15, near ") {"
/var/www/cgi-bin/register/register.pl has too many errors.
[Thu Dec 24 04:27:05.714035 2015] [cgid:error] [pid 18177:tid 140578498995968] [client 106.208.88.238:21431] End of script output before headers: register.pl
[Thu Dec 24 04:40:42.364455 2015] [mpm_event:notice] [pid 18173:tid 140578810890112] AH00494: SIGHUP received.  Attempting to restart
[Thu Dec 24 04:40:42.416326 2015] [mpm_event:notice] [pid 18173:tid 140578810890112] AH00489: Apache/2.4.7 (Ubuntu) configured -- resuming normal operations
[Thu Dec 24 04:40:42.416346 2015] [core:notice] [pid 18173:tid 140578810890112] AH00094: Command line: '/usr/sbin/apache2'
Can't locate Data/Alias.pm in @INC (you may need to install the Data::Alias module) (@INC contains: /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at /usr/local/share/perl/5.18.2/Method/Signatures.pm line 980.
Compilation failed in require at /var/www/cgi-bin/register/index.pl line 11.
BEGIN failed--compilation aborted at /var/www/cgi-bin/register/index.pl line 11.
[Thu Dec 24 04:41:59.664833 2015] [cgid:error] [pid 21137:tid 140578591315712] [client 106.208.88.238:21717] End of script output before headers: index.pl
Can't locate Data/Alias.pm in @INC (you may need to install the Data::Alias module) (@INC contains: /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at /usr/local/share/perl/5.18.2/Method/Signatures.pm line 980.
Compilation failed in require at /var/www/cgi-bin/register/index.pl line 11.
BEGIN failed--compilation aborted at /var/www/cgi-bin/register/index.pl line 11.
[Thu Dec 24 04:42:02.220502 2015] [cgid:error] [pid 21138:tid 140578549352192] [client 106.208.88.238:21718] End of script output before headers: index.pl
Can't locate Data/Alias.pm in @INC (you may need to install the Data::Alias module) (@INC contains: /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at /usr/local/share/perl/5.18.2/Method/Signatures.pm line 980.
Compilation failed in require at /var/www/cgi-bin/register/index.pl line 11.
BEGIN failed--compilation aborted at /var/www/cgi-bin/register/index.pl line 11.
[Thu Dec 24 04:44:49.927410 2015] [cgid:error] [pid 21138:tid 140578566137600] [client 106.208.88.238:21721] End of script output before headers: index.pl
[Thu Dec 24 04:54:15.130660 2015] [mpm_event:notice] [pid 18173:tid 140578810890112] AH00491: caught SIGTERM, shutting down
[Thu Dec 24 04:54:16.170870 2015] [mpm_event:notice] [pid 21771:tid 139956861183872] AH00489: Apache/2.4.7 (Ubuntu) configured -- resuming normal operations
[Thu Dec 24 04:54:16.170948 2015] [core:notice] [pid 21771:tid 139956861183872] AH00094: Command line: '/usr/sbin/apache2'
[Thu Dec 24 05:02:30.290833 2015] [cgid:error] [pid 22814:tid 139956861183872] (13)Permission denied: AH01241: exec of '/usr/lib/cgi-bin/index.pl' failed
[Thu Dec 24 05:02:30.291121 2015] [cgid:error] [pid 21775:tid 139956550829824] [client 106.208.88.238:21885] End of script output before headers: index.pl
[Thu Dec 24 05:02:40.239370 2015] [cgid:error] [pid 22815:tid 139956861183872] (13)Permission denied: AH01241: exec of '/usr/lib/cgi-bin/index.pl' failed
[Thu Dec 24 05:02:40.239626 2015] [cgid:error] [pid 21776:tid 139956626364160] [client 106.208.88.238:21886] End of script output before headers: index.pl
Can't locate Drivers/MySQL.pm in @INC (you may need to install the Drivers::MySQL module) (@INC contains: /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at /usr/lib/cgi-bin/index.pl line 9.
BEGIN failed--compilation aborted at /usr/lib/cgi-bin/index.pl line 9.
[Thu Dec 24 05:17:15.648064 2015] [cgid:error] [pid 21775:tid 139956592793344] [client 106.208.200.98:26239] End of script output before headers: index.pl
Can't locate Data/Alias.pm in @INC (you may need to install the Data::Alias module) (@INC contains: /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at /usr/local/share/perl/5.18.2/Method/Signatures.pm line 980.
Compilation failed in require at /usr/lib/cgi-bin/index.pl line 9.
BEGIN failed--compilation aborted at /usr/lib/cgi-bin/index.pl line 9.
[Thu Dec 24 05:22:21.030515 2015] [cgid:error] [pid 21776:tid 139956500473600] [client 106.208.200.98:26268] End of script output before headers: index.pl
Can't locate Data/Alias.pm in @INC (you may need to install the Data::Alias module) (@INC contains: /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at /usr/local/share/perl/5.18.2/Method/Signatures.pm line 980.
Compilation failed in require at /usr/lib/cgi-bin/index.pl line 9.
BEGIN failed--compilation aborted at /usr/lib/cgi-bin/index.pl line 9.
[Thu Dec 24 05:22:29.155624 2015] [cgid:error] [pid 21775:tid 139956643149568] [client 106.208.200.98:26270] End of script output before headers: index.pl
Can't locate Data/Alias.pm in @INC (you may need to install the Data::Alias module) (@INC contains: /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at /usr/local/share/perl/5.18.2/Method/Signatures.pm line 980.
Compilation failed in require at /usr/lib/cgi-bin/index.pl line 9.
BEGIN failed--compilation aborted at /usr/lib/cgi-bin/index.pl line 9.
[Thu Dec 24 05:26:59.929825 2015] [cgid:error] [pid 21775:tid 139956601186048] [client 106.208.200.98:26304] End of script output before headers: index.pl
Can't locate Data/Alias.pm in @INC (you may need to install the Data::Alias module) (@INC contains: /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at /usr/local/share/perl/5.18.2/Method/Signatures.pm line 980.
Compilation failed in require at /usr/lib/cgi-bin/index.pl line 9.
BEGIN failed--compilation aborted at /usr/lib/cgi-bin/index.pl line 9.
[Thu Dec 24 05:51:24.665808 2015] [cgid:error] [pid 21776:tid 139956525651712] [client 106.208.200.98:26704] End of script output before headers: index.pl
Can't locate Data/Alias.pm in @INC (you may need to install the Data::Alias module) (@INC contains: /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at /usr/local/share/perl/5.18.2/Method/Signatures.pm line 980.
Compilation failed in require at /usr/lib/cgi-bin/index.pl line 9.
BEGIN failed--compilation aborted at /usr/lib/cgi-bin/index.pl line 9.
[Thu Dec 24 05:53:44.378650 2015] [cgid:error] [pid 21776:tid 139956592793344] [client 106.208.200.98:26740] End of script output before headers: index.pl
Can't locate Data/Alias.pm in @INC (you may need to install the Data::Alias module) (@INC contains: /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at /usr/local/share/perl/5.18.2/Method/Signatures.pm line 980.
Compilation failed in require at /usr/lib/cgi-bin/index.pl line 9.
BEGIN failed--compilation aborted at /usr/lib/cgi-bin/index.pl line 9.
[Thu Dec 24 05:53:47.788531 2015] [cgid:error] [pid 21776:tid 139956584400640] [client 106.208.200.98:26741] End of script output before headers: index.pl
Can't locate Data/Alias.pm in @INC (you may need to install the Data::Alias module) (@INC contains: /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at /usr/local/share/perl/5.18.2/Method/Signatures.pm line 980.
Compilation failed in require at /usr/lib/cgi-bin/index.pl line 9.
BEGIN failed--compilation aborted at /usr/lib/cgi-bin/index.pl line 9.
[Thu Dec 24 06:01:51.924274 2015] [cgid:error] [pid 21775:tid 139956508866304] [client 106.208.200.98:26845] End of script output before headers: index.pl
Can't locate Data/Alias.pm in @INC (you may need to install the Data::Alias module) (@INC contains: /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at /usr/local/share/perl/5.18.2/Method/Signatures.pm line 980.
Compilation failed in require at /usr/lib/cgi-bin/index.pl line 9.
BEGIN failed--compilation aborted at /usr/lib/cgi-bin/index.pl line 9.
[Thu Dec 24 06:14:41.811638 2015] [cgid:error] [pid 21776:tid 139956525651712] [client 106.208.8.87:37448] End of script output before headers: index.pl
[Thu Dec 24 06:20:34.074040 2015] [cgid:error] [pid 25176:tid 139956861183872] (8)Exec format error: AH01241: exec of '/usr/lib/cgi-bin/index.pl' failed
[Thu Dec 24 06:20:34.074226 2015] [cgid:error] [pid 21776:tid 139956753745664] [client 106.208.8.87:37575] End of script output before headers: index.pl
[Thu Dec 24 06:20:36.556068 2015] [cgid:error] [pid 25177:tid 139956861183872] (8)Exec format error: AH01241: exec of '/usr/lib/cgi-bin/index.pl' failed
[Thu Dec 24 06:20:36.556361 2015] [cgid:error] [pid 21776:tid 139956668327680] [client 106.208.8.87:37576] End of script output before headers: index.pl
[Thu Dec 24 06:22:25.511908 2015] [cgid:error] [pid 25178:tid 139956861183872] (8)Exec format error: AH01241: exec of '/usr/lib/cgi-bin/index.pl' failed
[Thu Dec 24 06:22:25.512111 2015] [cgid:error] [pid 21776:tid 139956659934976] [client 106.208.8.87:37584] End of script output before headers: index.pl
[Thu Dec 24 06:22:41.714336 2015] [cgid:error] [pid 25179:tid 139956861183872] (8)Exec format error: AH01241: exec of '/usr/lib/cgi-bin/Drivers/MySQL.pm' failed
[Thu Dec 24 06:22:41.714585 2015] [cgid:error] [pid 21776:tid 139956651542272] [client 106.208.8.87:37585] End of script output before headers: MySQL.pm
[Thu Dec 24 06:29:55.940279 2015] [cgid:error] [pid 25401:tid 139956861183872] (8)Exec format error: AH01241: exec of '/usr/lib/cgi-bin/Drivers/MySQL.pm' failed
[Thu Dec 24 06:29:55.940485 2015] [cgid:error] [pid 21776:tid 139956626364160] [client 106.208.8.87:37713] End of script output before headers: MySQL.pm
[Thu Dec 24 06:29:58.537769 2015] [cgid:error] [pid 25402:tid 139956861183872] (8)Exec format error: AH01241: exec of '/usr/lib/cgi-bin/Drivers/MySQL.pm' failed
[Thu Dec 24 06:29:58.538022 2015] [cgid:error] [pid 21776:tid 139956609578752] [client 106.208.8.87:37714] End of script output before headers: MySQL.pm
[Thu Dec 24 06:30:07.320777 2015] [cgid:error] [pid 25403:tid 139956861183872] (8)Exec format error: AH01241: exec of '/usr/lib/cgi-bin/index.pl' failed
[Thu Dec 24 06:30:07.320967 2015] [cgid:error] [pid 21776:tid 139956601186048] [client 106.208.8.87:37715] End of script output before headers: index.pl

通过在终端中键入perl -v来检查您的perl版本。 如果它是5.20 <,则应该安装perl模块CGI.pm,因为它已从核心perl软件包中删除。 在您的perl代码的顶部,您已编写为

use strict;
use warnings;
use CGI;
use Method::Signatures;
use Digest::MD5 qw(md5_hex);
use Drivers::MySQL;
use feature qw(say);

print header(); #########

my %arrConfig = (
        dbHost => '127.0.0.1',
        dbName => 'Luna',
        dbUser => 'root',
        dbPass => 'password123'
);

my $objHtml = CGI->new; #########
my $objMysql = MySQL->new;

据我所知,它应该写成如下:

use strict;
use warnings;
use CGI;
use Method::Signatures;
use Digest::MD5 qw(md5_hex);
use Drivers::MySQL;
use feature qw(say);

my $objHtml = CGI->new; #########

print $objHtml->header(); #########

my %arrConfig = (
        dbHost => '127.0.0.1',
        dbName => 'Luna',
        dbUser => 'root',
        dbPass => 'password123'
);
my $objMysql = MySQL->new;

希望它能正常工作...请使用以下命令perl -c运行以下命令以了解perl中是否还有其他语法错误。 这将帮助您识别服务器中所有缺少的模块。

以下是错误日志的重要部分:

无法在@INC中找到Drivers / MySQL.pm(您可能需要安装Drivers :: MySQL模块)(@ INC包含:/ etc / perl /usr/local/lib/perl/5.18.2 / usr / local /share/perl/5.18.2 / usr / lib / perl5 / usr / share / perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 / usr / local / lib / site_perl。)在/ var / www / cgi-bin / register / index.pl第11行。BEGIN失败-在/var/www/cgi-bin/register/index.pl第11行中,编译中止。

和:

在@INC中找不到Data / Alias.pm(您可能需要安装Data :: Alias模块)(@ INC包含:/ etc / perl /usr/local/lib/perl/5.18.2 / usr / local /share/perl/5.18.2 / usr / lib / perl5 / usr / share / perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 / usr / local / lib / site_perl。)在/ usr / local / share / perl / 5.18.2 / Method / Signatures.pm第980行。在/var/www/cgi-bin/register/index.pl第11行的要求中编译失败。BEGIN失败-在/ var /处编译中止www / cgi-bin / register / index.pl第11行

有两个模块叫做Drivers :: MySQL和Data :: Alias missing。 遗漏是指以下两种情况之一是正确的:

  1. 该服务器上未安装该模块。
  2. 该模块已安装在此服务器上,但不在Perl查找库的目录之一中。

该错误消息为您提供了Perl在其中查找库的目录列表(位于名为@INC的变量中)。

您有两个解决方案。 将模块的本地副本移动到@INC中的目录之一,或者(可能更好)调整@INC以包括模块所在的目录。 通常use lib语句完成此操作。 例如:

use lib ('/path/to/the/directory/that/includes/Drivers',
         '/path/to/the/directory/that/includes/Data');

从您的日志中:

无法在@INC中找到Drivers / MySQL.pm(您可能需要安装Drivers :: MySQL模块)(@ INC包含:/ etc / perl /usr/local/lib/perl/5.18.2 / usr / local /share/perl/5.18.2 / usr / lib / perl5 / usr / share / perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 / usr / local / lib / site_perl。)在/ var / www / cgi-bin / register / index.pl第11行。BEGIN失败-在/var/www/cgi-bin/register/index.pl第11行中,编译中止。

您需要安装Drivers :: MySQL模块。

希望cpanm Drivers::MySQL可以做到,但是cpan有更多说明。

您在Data::Alias也遇到类似的问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM