Perl Apache Issue - apache
I cant seem to even fix this issue, I've tried so many things and nothing will work...
I'm basically doing this for a friend of mine, I've setup apache properly in his ubuntu server but whenever I try to access the register file in usr/lib/cgi-bin, it keeps giving me a 500 internal server error.
This is the site configuration file(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
This is the register file:
#!/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;
}
I've changed the file permission to 755 and checked the syntax and its all fine.
Is there something I'm not seeing? All the error log says is "End of script output before headers".
Error log:
Error log as per request:
[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
Here are the important parts of your error log:
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.
And:
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
There's are two modules called Drivers::MySQL and Data::Alias missing. By missing I mean one of these two situations is true:
The module isn't installed on this server.
The module is installed on this server, but it isn't in one of the directories where Perl looks for libraries.
The error message gives you the list of directories where Perl looks for libraries (it's in the variable called #INC).
You have two options for fixing it. Either move the local copy of the module to one of the directories in #INC or (probably better) adjust #INC to include the directory where your module is. This is usually done with a use lib statement. For example:
use lib ('/path/to/the/directory/that/includes/Drivers',
'/path/to/the/directory/that/includes/Data');
Check your perl version by typing perl -v in the terminal. If it is 5.20< , you should install perl module CGI.pm since it has been removed from the core perl bundle.
In the top portion of your perl code, you had written as
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;
As far as I know, it should be written as follows:
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;
Hope this will work fine...
Please run following command to know if there any other syntax error in the perl using following command perl -c . It will help you identify any missing modules in the server.
From your log:
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.
You need to install the Drivers::MySQL module.
Hopefully cpanm Drivers::MySQL will do that, but cpan has more instructions.
You have a similar issue with Data::Alias.
Related
Apache/mod_perl randomly fails
We are running a web-based application on Ubuntu/Apache/mod_perl and with increased use we are starting to randomly experience problems with our programs. The server is running Ubuntu 16.04.6 LTS and Apache/2.4.18. But this happens on different servers with different Ubuntu and Apache versions. It can run fine for hours and then fail repeatedly for about a minute. I can understand if it was our code which fails and if it was doing so in a consequent way but it feels like the problem is something else than the error logs indicates. Below is some lines taken from the /var/log/apache/error.log The first (and last) couple of lines show errors in our code/modules (which ran perfectly just before this) but then it starts to fail in ModPerl::Registry, Hash::Merge, etc. I'm totally out of debugging ideas. I have noted that the same kind of error comes from the same Apache pid (different thread ids) if that is a clue in any way... [Mon Oct 14 15:24:43.513420 2019] [:error] [pid 97911:tid 140590008215296] Attempt to reload WebGUI.pm aborted.\nCompilation failed in require at /opt/vps/cgi/ANPR/ndi_bridge line 13.\nBEGIN failed--compilation aborted at /opt/vps/cgi/ANPR/ndi_bridge line 13.\n [Mon Oct 14 15:24:44.722253 2019] [:error] [pid 97911:tid 140589941073664] Attempt to reload WebGUI.pm aborted.\nCompilation failed in require at /opt/vps/cgi/ANPR/ndi_bridge line 13.\nBEGIN failed--compilation aborted at /opt/vps/cgi/ANPR/ndi_bridge line 13.\n [Mon Oct 14 15:24:45.586512 2019] [:error] [pid 97911:tid 140589924288256] Attempt to reload WebGUI.pm aborted.\nCompilation failed in require at /opt/vps/cgi/ANPR/ndi_bridge line 13.\nBEGIN failed--compilation aborted at /opt/vps/cgi/ANPR/ndi_bridge line 13.\n [Mon Oct 14 15:27:05.083671 2019] [perl:error] [pid 15164:tid 140590016608000] [client 66.109.33.18:57443] failed to resolve handler `ModPerl::Registry': Global symbol "$VERSION" requires explicit package name (did you forget to declare "my $VERSION"?) at /usr/share/perl/5.22/base.pm line 5.\nGlobal symbol "$VERSION" requires explicit package name (did you forget to declare "my $VERSION"?) at /usr/share/perl/5.22/base.pm line 6.\nGlobal symbol "$VERSION" requires explicit package name (did you forget to declare "my $VERSION"?) at /usr/share/perl/5.22/base.pm line 6.\nCompilation failed in require at /usr/lib/x86_64-linux-gnu/perl5/5.22/ModPerl/Registry.pm line 27.\nBEGIN failed--compilation aborted at /usr/lib/x86_64-linux-gnu/perl5/5.22/ModPerl/Registry.pm line 27.\nCompilation failed in require at (eval 2) line 2.\n [Mon Oct 14 15:27:05.129761 2019] [perl:error] [pid 15164:tid 140590008215296] [client 66.109.33.18:39384] failed to resolve handler `ModPerl::Registry': Attempt to reload ModPerl/Registry.pm aborted.\nCompilation failed in require at (eval 3) line 2.\n [Mon Oct 14 15:27:05.852243 2019] [perl:error] [pid 15164:tid 140589991429888] [client 75.112.148.15:38062] failed to resolve handler `ModPerl::Registry': Attempt to reload ModPerl/Registry.pm aborted.\nCompilation failed in require at (eval 4) line 2.\n [Mon Oct 14 15:27:06.893502 2019] [perl:error] [pid 15164:tid 140589983037184] [client 75.112.148.15:38064] failed to resolve handler `ModPerl::Registry': Attempt to reload ModPerl/Registry.pm aborted.\nCompilation failed in require at (eval 5) line 2.\n [Mon Oct 14 15:45:22.457316 2019] [perl:error] [pid 12288:tid 140590033393408] [client 66.109.33.18:4390] failed to resolve handler `ModPerl::Registry': Can't locate object method "install_aliases" via package "ModPerl::Registry" at /usr/lib/x86_64-linux-gnu/perl5/5.22/ModPerl/Registry.pm line 70.\nCompilation failed in require at (eval 2) line 2.\n [Mon Oct 14 15:45:26.659826 2019] [perl:error] [pid 12288:tid 140589915895552] [client 75.112.148.15:40162] failed to resolve handler `ModPerl::Registry': Attempt to reload ModPerl/Registry.pm aborted.\nCompilation failed in require at (eval 4) line 2.\n [Mon Oct 14 16:08:56.112937 2019] [perl:error] [pid 22685:tid 140590157600512] [client 172.16.2.36:37144] failed to resolve handler `ModPerl::Registry': Global symbol "$VERSION" requires explicit package name (did you forget to declare "my $VERSION"?) at /usr/lib/x86_64-linux-gnu/perl/5.22/File/Spec.pm line 6.\nGlobal symbol "$VERSION" requires explicit package name (did you forget to declare "my $VERSION"?) at /usr/lib/x86_64-linux-gnu/perl/5.22/File/Spec.pm line 7.\nGlobal symbol "#ISA" requires explicit package name (did you forget to declare "my #ISA"?) at /usr/lib/x86_64-linux-gnu/perl/5.22/File/Spec.pm line 22.\nCompilation failed in require at /usr/lib/x86_64-linux-gnu/perl/5.22/File/Spec/Functions.pm line 3.\nBEGIN failed--compilation aborted at /usr/lib/x86_64-linux-gnu/perl/5.22/File/Spec/Functions.pm line 3.\nCompilation failed in require at /usr/lib/x86_64-linux-gnu/perl5/5.22/ModPerl/RegistryCooker.pm line 46.\nBEGIN failed--compilation aborted at /usr/lib/x86_64-linux-gnu/perl5/5.22/ModPerl/RegistryCooker.pm line 46.\nCompilation failed in require at /usr/share/perl/5.22/base.pm line 97.\n\t...propagated at /usr/share/perl/5.22/base.pm line 106.\nBEGIN failed--compilation aborted at /usr/lib/x86_64-linux-gnu/perl5/5.22/ModPerl/Registry.pm line 27.\nCompilation failed in require at (eval 2) line 2.\n [Mon Oct 14 16:08:56.372992 2019] [perl:error] [pid 22685:tid 140590149207808] [client 97.68.152.67:55067] failed to resolve handler `ModPerl::Registry': Attempt to reload ModPerl/Registry.pm aborted.\nCompilation failed in require at (eval 4) line 2.\n [Mon Oct 14 16:09:02.533403 2019] [perl:error] [pid 22685:tid 140590050178816] [client 172.16.2.36:37152] failed to resolve handler `ModPerl::Registry': Attempt to reload ModPerl/Registry.pm aborted.\nCompilation failed in require at (eval 5) line 2.\n [Mon Oct 14 16:09:05.121083 2019] [perl:error] [pid 22685:tid 140589957859072] [client 66.109.33.18:52036] failed to resolve handler `ModPerl::Registry': Attempt to reload ModPerl/Registry.pm aborted.\nCompilation failed in require at (eval 6) line 2.\n [Mon Oct 14 16:09:05.222048 2019] [perl:error] [pid 22685:tid 140589949466368] [client 66.109.33.18:46229] failed to resolve handler `ModPerl::Registry': Attempt to reload ModPerl/Registry.pm aborted.\nCompilation failed in require at (eval 7) line 2.\n [Mon Oct 14 16:09:05.245198 2019] [perl:error] [pid 22685:tid 140589941073664] [client 75.112.148.15:42640] failed to resolve handler `ModPerl::Registry': Attempt to reload ModPerl/Registry.pm aborted.\nCompilation failed in require at (eval 8) line 2.\n [Mon Oct 14 16:09:05.284797 2019] [perl:error] [pid 22685:tid 140589966251776] [client 75.112.148.15:42642] failed to resolve handler `ModPerl::Registry': Attempt to reload ModPerl/Registry.pm aborted.\nCompilation failed in require at (eval 9) line 2.\n [Mon Oct 14 16:09:05.323840 2019] [perl:error] [pid 22685:tid 140589932680960] [client 75.112.148.15:42644] failed to resolve handler `ModPerl::Registry': Attempt to reload ModPerl/Registry.pm aborted.\nCompilation failed in require at (eval 10) line 2.\n [Mon Oct 14 16:09:05.455646 2019] [perl:error] [pid 22685:tid 140589915895552] [client 172.16.2.27:33724] failed to resolve handler `ModPerl::Registry': Attempt to reload ModPerl/Registry.pm aborted.\nCompilation failed in require at (eval 11) line 2.\n [Mon Oct 14 17:44:20.506512 2019] [:error] [pid 93924:tid 140590149207808] syntax error at /usr/share/perl5/Hash/Merge.pm line 111, near "croak "Behavior '$beh' does not exist""\nGlobal symbol "$beh" requires explicit package name (did you forget to declare "my $beh"?) at /usr/share/perl5/Hash/Merge.pm line 111.\nGlobal symbol "$beh" requires explicit package name (did you forget to declare "my $beh"?) at /usr/share/perl5/Hash/Merge.pm line 114.\nGlobal symbol "$beh" requires explicit package name (did you forget to declare "my $beh"?) at /usr/share/perl5/Hash/Merge.pm line 115.\nGlobal symbol "$pkg" requires explicit package name (did you forget to declare "my $pkg"?) at /usr/share/perl5/Hash/Merge.pm line 116.\nsyntax error at /usr/share/perl5/Hash/Merge.pm line 117, near "}"\nsyntax error at /usr/share/perl5/Hash/Merge.pm line 123, near "carp 'Behavior must be one of : '"\nsyntax error at /usr/share/perl5/Hash/Merge.pm line 123, near "} }"\nsyntax error at /usr/share/perl5/Hash/Merge.pm line 125, near "}"\nsyntax error at /usr/share/perl5/Hash/Merge.pm line 130, near "}"\n/usr/share/perl5/Hash/Merge.pm has too many errors.\nCompilation failed in require at /opt/vps/lib/Time.pm line 5.\nBEGIN failed--compilation aborted at /opt/vps/lib/Time.pm line 5.\nCompilation failed in require at /opt/vps/lib/ProcessDefinition.pm line 19.\nBEGIN failed--compilation aborted at /opt/vps/lib/ProcessDefinition.pm line 19.\nCompilation failed in require at /opt/vps/lib/Session.pm line 9.\nBEGIN failed--compilation aborted at /opt/vps/lib/Session.pm line 9.\nCompilation failed in require at /opt/vps/cgi/ANPR/ndi_bridge line 11.\nBEGIN failed--compilation aborted at /opt/vps/cgi/ANPR/ndi_bridge line 11.\n [Mon Oct 14 17:44:20.547596 2019] [:error] [pid 93924:tid 140590140815104] Attempt to reload Session.pm aborted.\nCompilation failed in require at /opt/vps/cgi/ANPR/ndi_bridge line 11.\nBEGIN failed--compilation aborted at /opt/vps/cgi/ANPR/ndi_bridge line 11.\n [Mon Oct 14 17:44:20.587327 2019] [:error] [pid 93924:tid 140590132422400] Attempt to reload Session.pm aborted.\nCompilation failed in require at /opt/vps/cgi/ANPR/ndi_bridge line 11.\nBEGIN failed--compilation aborted at /opt/vps/cgi/ANPR/ndi_bridge line 11.\n [Mon Oct 14 17:44:20.641751 2019] [:error] [pid 93924:tid 140590041786112] Attempt to reload Session.pm aborted.\nCompilation failed in require at /opt/vps/cgi/ANPR/ndi_bridge line 11.\nBEGIN failed--compilation aborted at /opt/vps/cgi/ANPR/ndi_bridge line 11.\n
Ubuntu 14 - Apache2 not running with ENVVARS
I'm currently experimenting with Puppet and have run into an error where it's starting apache2 without the environment variables. I've been following example 1 and it's a very simple manifest but it throws the below errors; [Mon May 18 23:18:35.725947 2015] [core:warn] [pid 5312] AH00111: Config variable ${APACHE_LOCK_DIR} is not defined [Mon May 18 23:18:35.726451 2015] [core:warn] [pid 5312] AH00111: Config variable ${APACHE_PID_FILE} is not defined [Mon May 18 23:18:35.726538 2015] [core:warn] [pid 5312] AH00111: Config variable ${APACHE_RUN_USER} is not defined [Mon May 18 23:18:35.726611 2015] [core:warn] [pid 5312] AH00111: Config variable ${APACHE_RUN_GROUP} is not defined [Mon May 18 23:18:35.726696 2015] [core:warn] [pid 5312] AH00111: Config variable ${APACHE_LOG_DIR} is not defined [Mon May 18 23:18:35.750730 2015] [core:warn] [pid 5312] AH00111: Config variable ${APACHE_LOG_DIR} is not defined [Mon May 18 23:18:35.751241 2015] [core:warn] [pid 5312] AH00111: Config variable ${APACHE_LOG_DIR} is not defined [Mon May 18 23:18:35.751331 2015] [core:warn] [pid 5312] AH00111: Config variable ${APACHE_LOG_DIR} is not defined AH00526: Syntax error on line 74 of /etc/apache2/apache2.conf: Invalid Mutex directory in argument file:${APACHE_LOCK_DIR} I know the issue is around it not loading in the envvar file and this can be done if I don't run it from Puppet but i'm looking for a solution so I can use puppet to create servers. Any ideas? My Puppet manifest is below: # execute 'apt-get update' exec { 'apt-update': # exec resource named 'apt-update' command => '/usr/bin/apt-get update' # command this resource will run } # install apache2 package package { 'apache2': require => Exec['apt-update'], # require 'apt-update' before installing ensure => installed, } # ensure apache2 service is running service { 'apache2': ensure => running, } # install mysql-server package package { 'mysql-server': require => Exec['apt-update'], # require 'apt-update' before installing ensure => installed, } # ensure mysql service is running service { 'mysql': ensure => running, } # install php5 package package { 'php5': require => Exec['apt-update'], # require 'apt-update' before installing ensure => installed, } # ensure info.php file exists file { '/var/www/html/info.php': ensure => file, content => '<?php phpinfo(); ?>', # phpinfo code require => Package['apache2'], # require 'apache2' package before creating }
Tool to upgrade current python installation
I have Python 2.7 installed with ampps. I tried to modify python.conf to make it point to another installation of Python 3.3 but it leads to errors in Apache start up. LoadModule wsgi_module modules/mod_wsgi.so WSGIPythonPath "C:/Python33/Lib;C:/Python33/Lib/site-packages;C:/Python33/DLLs" WSGIPythonHome "C:/Python33" It generates the following error: [Fri Aug 15 01:48:38.114336 2014] [mpm_winnt:notice] [pid 6084:tid 412] AH00418: Parent: Created child process 5592 File "C:/Python33\lib\site.py", line 173 file=sys.stderr) ^ SyntaxError: invalid syntax [Fri Aug 15 01:48:39.146395 2014] [mpm_winnt:crit] [pid 6084:tid 412] AH00419: master_main: create child process failed. Exiting.
mod_wsgi is compiled in one version and running in a different version even after following the given steps
I am getting an error when I run the apache server through my client after going through the log I understood that the mod_wsgi uses python 2.6 during compiling and uses python 2.7 for running. After some research in the Internet I followed the below steps: You have to recompile mod-python and/or mod-wsgi. Remove mods apt-get remove libapache2-mod-python libapache2-mod-wsgi Get dependencies apt-get build-dep libapache2-mod-python libapache2-mod-wsgi Build mod-python mkdir /tmp/python cd /tmp/python apt-get source libapache2-mod-python cd libapache2-mod-python-[x.x.x] dpkg-buildpackage -rfakeroot -b Build mod-wsgi mkdir /tmp/wsgi cd /tmp/wsgi apt-get source libapache2-mod-wsgi cd mod-wsgi-[x.x.x] dpkg-buildpackage -rfakeroot -b Install newly compiled packages dpkg -i /tmp/python/libapache2-mod-python-[x.x].deb /tmp/wsgi/libapache2-mod-wsgi-[x.x].deb It was of no use, now the version has changed to 3.2, I am worried about the space being consumed through the above steps and now the compiling python has changes to python 3.2 from 2.6 but the python used for running is still 2.7. please help me with what to do ? to get back my apache server running successfully. error.log:::: [Wed Aug 21 11:48:11 2013] [warn] mod_wsgi: Compiled for Python/2.7.2+. [Wed Aug 21 11:48:11 2013] [warn] mod_wsgi: Runtime using Python/2.7.3. [Wed Aug 21 11:48:11 2013] [notice] Apache/2.2.22 (Ubuntu) mod_wsgi/3.3 Python/2.7.3 configured -- resuming normal operations [Wed Aug 21 11:48:36 2013] [notice] caught SIGTERM, shutting down [Wed Aug 21 22:48:29 2013] [error] child process 1226 still did not exit, sending a SIGKILL [Wed Aug 21 22:48:30 2013] [notice] caught SIGTERM, shutting down [Wed Aug 21 22:56:17 2013] [warn] mod_wsgi: Compiled for Python/2.7.2+. [Wed Aug 21 22:56:17 2013] [warn] mod_wsgi: Runtime using Python/2.7.3. [Wed Aug 21 22:56:17 2013] [notice] Apache/2.2.22 (Ubuntu) mod_wsgi/3.3 Python/2.7.3 configured -- resuming normal operations [Thu Aug 22 01:32:12 2013] [notice] caught SIGTERM, shutting down [Thu Aug 22 01:32:26 2013] [warn] mod_wsgi: Compiled for Python/2.7.2+. [Thu Aug 22 01:32:26 2013] [warn] mod_wsgi: Runtime using Python/2.7.3. [Thu Aug 22 01:32:26 2013] [notice] Apache/2.2.22 (Ubuntu) mod_wsgi/3.3 Python/2.7.3 configured -- resuming normal operations [Thu Aug 22 04:04:48 2013] [notice] child pid 11212 exit signal Segmentation fault (11) [Thu Aug 22 04:04:48 2013] [notice] caught SIGTERM, shutting down [Thu Aug 22 04:04:56 2013] [notice] mod_python: Creating 8 session mutexes based on 6 max processes and 25 max threads. [Thu Aug 22 04:04:56 2013] [notice] mod_python: using mutex_directory /tmp [Thu Aug 22 04:04:56 2013] [warn] mod_wsgi: Compiled for Python/3.2.3. [Thu Aug 22 04:04:56 2013] [warn] mod_wsgi: Runtime using Python/2.7.3. [Thu Aug 22 04:04:56 2013] [notice] Apache/2.2.22 (Ubuntu) mod_python/3.3.1 Python/2.7.3 mod_wsgi/3.3 configured -- resuming normal operations Thank you
Don't load mod_python and mod_wsgi at the same time if you don't need to. They are likely compiled against different Python versions. See the following for an explanation of the mismatch you are seeing. http://code.google.com/p/modwsgi/wiki/InstallationIssues#Python_Version_Mismatch If you do need both, they must both be compiled for the same version. These days there is generally no good reason to be using mod_python for new projects.
Just to add I have uninstalled libapache2-mod-python sudo apt-get remove libapache2-mod-python which I have installed then I have overcome the above error [Thu Aug 22 01:32:26 2013] [warn] mod_wsgi: Compiled for Python/2.7.2+. [Thu Aug 22 01:32:26 2013] [warn] mod_wsgi: Runtime using Python/2.7.3.
DigitalOcean Deploy - "ImportError: No module named flask.ext.wtf"
All, I'm trying to deploy a simple page using flask/apache on a digitalocean server. It all works fine locally, but not on the server. __init__.py contains the statement: from flask.ext.wtf import Form,TextField try_me.wsgi is: #!/usr/bin/python import sys import logging logging.basicConfig(stream=sys.stderr) sys.path.insert(0,"/var/www/try_me/") from try_me import app as application application.secret_key = 'Add your secret key' Getting the following error (from /var/log/apache2/error.log): [Mon Jul 29 14:16:50 2013] [warn] mod_wsgi: Compiled for Python/2.7.2+. [Mon Jul 29 14:16:50 2013] [warn] mod_wsgi: Runtime using Python/2.7.3. [Mon Jul 29 14:16:50 2013] [notice] Apache/2.2.22 (Debian) mod_wsgi/3.3 Python/2.7.3 configured -- resuming normal operations [Mon Jul 29 14:16:57 2013] [error] [client 74.66.8.166] mod_wsgi (pid=2920): Target WSGI script '/var/www/try_me/try_me.wsgi' cannot be loaded as Python module. [Mon Jul 29 14:16:57 2013] [error] [client 74.66.8.166] mod_wsgi (pid=2920): Exception occurred processing WSGI script '/var/www/try_me/try_me.wsgi'. [Mon Jul 29 14:16:57 2013] [error] [client 74.66.8.166] Traceback (most recent call last): [Mon Jul 29 14:16:57 2013] [error] [client 74.66.8.166] File "/var/www/try_me/try_me.wsgi", line 7, in <module> [Mon Jul 29 14:16:57 2013] [error] [client 74.66.8.166] from try_me import app as application [Mon Jul 29 14:16:57 2013] [error] [client 74.66.8.166] File "/var/www/try_me/try_me/__init__.py", line 4, in <module> [Mon Jul 29 14:16:57 2013] [error] [client 74.66.8.166] from flask.ext.wtf import Form [Mon Jul 29 14:16:57 2013] [error] [client 74.66.8.166] File "/usr/local/lib/python2.7/dist-packages/flask/exthook.py", line 87, in load_module [Mon Jul 29 14:16:57 2013] [error] [client 74.66.8.166] raise ImportError('No module named %s' % fullname) [Mon Jul 29 14:16:57 2013] [error] [client 74.66.8.166] ImportError: No module named flask.ext.wtf I was able to import manually in a python interpreter (under virtualenv): Python 2.7.3 (default, Jan 2 2013, 16:53:07) [GCC 4.7.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from flask.ext.wtf import Form >>> Form <class 'flask_wtf.form.Form'> Any ideas on how to proceed here?
SOLUTION (Following Cathy's advice above, and dAnjou below), virtualenv must be activated from the wsgi script. Adding activate_this execution solved the problem: #!/usr/bin/python activate_this = '/var/www/try_me/venv/bin/activate_this.py' execfile(activate_this, dict(__file__=activate_this)) import sys ..