I just upgraded my server and now a simple log script reaks of errors.

#!/usr/bin/perl
use CGI ':standard';
use warnings;

$database = "/full_path/filename.shtml";

$shortdate = `date +"%D %T %Z"`;
chop ($shortdate);
open (DATABASE,">>$database");
print DATABASE "$ENV{'REMOTE_ADDR'} - $shortdate - $ENV{'SCRIPT_URI'} - $ENV{'HTTP_USER_AGENT'}<!-- - $ENV{'HTTP_REFERER'}--><BR>\n";
close(DATABASE);
{
print "Content-Type: text/html\n\n";
print <<EOM;
<PRE>
</PRE>
EOM
exit;
}

When using SSH to get the error, it spits out

Use of uninitialized value in concatenation (.) or string at ebaylogs.cgi line 10.
Use of uninitialized value in concatenation (.) or string at ebaylogs.cgi line 10.
Use of uninitialized value in concatenation (.) or string at ebaylogs.cgi line 10.
Use of uninitialized value in concatenation (.) or string at ebaylogs.cgi line 10.

like it now can't recognize the $ENV stuff. I try to upgrade it to strict...

#!/usr/bin/perl
use CGI ':standard';
use strict;
use warnings;
use CGI::Carp qw(warningsToBrowser fatalsToBrowser);

my $database = "/var/www/vhosts/cmgscc.com/httpdocs/craigslist/ebaylogs.shtml";

my $REMOTE_ADDR = "$ENV{'REMOTE_ADDR'}";
my $scripturi = "$ENV{'SCRIPT_URI'}";
my $HTTP_USER_AGENT = "$ENV{'HTTP_USER_AGENT'}";
my $HTTP_REFERER = "$ENV{'HTTP_REFERER'}";


my $shortdate = `date +"%D %T %Z"`;
chop ($shortdate);
    open (DATABASE,">>$database");
        print DATABASE "$REMOTE_ADDR - $shortdate - $scripturi - $HTTP_USER_AGENT<!-- - $HTTP_REFERER--><BR>\n";
    close(DATABASE);

{
   print "Content-Type: text/html\n\n";
print <<EOM;
<PRE>
</PRE>
EOM
   exit;
}

and it also does the same thing. Only the date goes through.

chmod'ing all folders 777, back to the domain does it. For example, two folders and a file...

httpdocs/folder/file.shtml

and it then works.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.