#!/usr/bin/perl -w use strict; use warnings; use CGI; use Data::Dumper; use CGI::Carp qw(fatalsToBrowser); my $cgi; BEGIN{ $cgi = CGI->new; print $cgi->header; unshift @INC, "/var/www/vhosts/myDomain.com/secured.myDomain.com/cgi-bin/library"; # pick one of print STDERR $ENV{SERVER_ADDR}, "\n"; # to ISP error log # or print $ENV{SERVER_ADDR}, "\n"; # to browser -- that's why I moved the cgi->header print to above, in the BEGIN # or open my $logfile, '>>', 'writable/path/to/logfile.txt' or die "error appending to logfile"; print {$logfile} $ENV{SERVER_ADDR}, "\n"; # to your own error log # other possible environment variables listed at http://www.cgi101.com/book/ch3/text.html } use doctypeAndHeader; header();