<> wrote:
> On 21 Jan, 11:32, philip.kings...@yahoo.com wrote:
>> Hello,
>> How can I get hold of the errors from a CGI below. It works fine on
>> the command line - but fails silently when invoked via cgi? The query
>> just ask for a describe on a table.
>> Thanks for your help...
>>
>> Phil
>>
>> #!/usr/local/bin/perl
>>
>> use strict;
>> use warnings;
>> use CGI::Carp qw(fatalsToBrowser);
>> use CGI ':standard';
>> use DBI;
>> my $dbh = DBI->connect( 'dbi:Oracle:FRED',
>> 'bert', 'bert', { RaiseError => 1, AutoCommit => 0 }
>> ) || die "Database connection not made: $DBI::errstr";
>> ...
>
> I now know that it is this last line that causes the problem - I get a
> "cannot execute contact your sysadmin from the web server" if I
> include this line - and no error if I inlcud ethe line above.
> As this works on the commandline but not here I suspect the
> environment -
I suspect that your CGI program does not run as the same user as
when you tried it from the command line...
Find out what user it is running as:
warn "user is ", scalar(getpwuid $<), "\n";
> Please how can I dump the environment?
print "$_ => $ENV{$_}\n" for sort keys %ENV;
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"