2015-12-24 27 views
1

我似乎無法即使解決這個問題,我已經嘗試了這麼多的事情,沒有什麼會工作......Perl的Apache發行

基本上,我做這行我的一個朋友,我設置的Apache正確地在他的Ubuntu服務器,但每當我嘗試訪問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 [email protected] 
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 
+0

500錯誤的常見原因是腳本死亡。幾乎總是有跡象表明它爲什麼會死在apache錯誤日誌中,所以請看那裏。 – ysth

+0

把'使用CGI ::鯉魚qw(fatalsToBrowser);'放在頂部。然後,如果腳本完全運行,您應該在瀏覽器中獲得一些有意義的信息。 –

回答

1

通過在終端中輸入的perl -v檢查Perl版本。如果它是5.20 <,則應該安裝perl模塊CGI.pm,因爲它已從核心perl包中刪除。

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代碼的頂部,你就據我所知,應該按如下方式寫入寫成

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; 

請運行以下命令以使用以下命令perl -c知道perl中是否存在任何其他語法錯誤。它將幫助您識別服務器中缺少的任何模塊。

+0

試過這個,仍然顯示內部服務器錯誤。我以前使用過很多Ubuntu服務器...這是我第一次登陸這樣的問題... – user2524169

+0

你可以發佈數據在你的錯誤日誌? –

+0

增加了它,抱歉關於fornat:s im在手機上 – user2524169

0

從你的日誌:

無法找到在@INC驅動器/ MySQL.pm(您可能需要安裝驅動程序:: MySQL的模塊)(@公司包含:在/ 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

1

這裏是你的錯誤日誌中的重要部分:

無法找到在@INC驅動器/ MySQL.pm(您可能需要安裝驅動程序 的MySQL ::模塊)(@公司包含:/ 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失敗 - 編譯在/ var/www中斷/cgi-bin/register/index.pl線11

和:

在@公司無法找到數據/ Alias.pm(您可能需要安裝 數據::別名模塊)(@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 。)at /usr/local/share/perl/5.18.2/Method/Signatures.pm line 980. 編譯在/var/www/cgi-bin/register/index.pl 第11行中失敗。BEGIN失敗 - 編譯在 /var/www/cgi-bin/register/index.pl線中斷11

有兩個模塊調用驅動程序:: MySQL和數據::別名失蹤。由於缺少,我的意思是這兩種情況之一是正確的:

  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');