I am running a cgi script from an onclick event in html.
HTML
<button onclick="self.location='http:**link**/test.cgi?myfield=PRD7-QF_P7';">Click me</button>
test.cgi Script
use DBI;
use CGI::Carp qw(carpout fatalsToBrowser);
BEGIN
{
$ENV{'ORACLE_HOME'}='/data/softs/oracle/10.2.0.3/';
$ENV{'LD_LIBRARY_PATH'}='/data/softs/oracle/10.2.0.3/lib';
}
my $cgi = CGI->new;
#my $parameter = $cgi->param("myfield");
print "Content-type: text/html\n\n";
my $version = "2.1";
my $cgi = CGI->new;
my $parameter = $cgi->param("myfield");
print "Content-type: text/html\n\n";
print "This is a test perl script\n\n";
print "Parameter=${parameter}\n";
my $connection_details = DBstringToConnection($parameter);
my $AMDORA_TNS_FM = @$connection_details[0];
my $AMDORA_USER_FM = @$connection_details[1];
my $AMDORA_PASSWORD_FM = @$connection_details[2];
my $AMDORA_SCHEMA_FM = @$connection_details[3];
my $AMDORA_SERVICE_FM = @$connection_details[4];
my $dbhfm = DBI->connect("dbi:Oracle:$AMDORA_TNS_FM", $AMDORA_USER_FM,$AMDORA_PASSWORD_FM)
or die DBI->errstr;
I am setting the Oracle_home and ld_library_path at the start of file. When i run the cgi script from unix terminal it's working fine. But when i run the script from the browser HTML file, it's giving this error:
install_driver(Oracle) failed: Can't locate DBD/Oracle.pm in @INC (@INC contains: /usr/lib/perl5/5.10.0/x86_64-linux-thread-multi /usr/lib/perl5/5.10.0 /usr/lib/perl5/site_perl/5.10.0/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.10.0 /usr/lib/perl5/vendor_perl/5.10.0/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.10.0 /usr/lib/perl5/vendor_perl .) at (eval 9) line 3.
Perhaps the DBD::Oracle perl module hasn't been fully installed,
or perhaps the capitalisation of 'Oracle' isn't right.
Available drivers: DBM, ExampleP, File, Gofer, Proxy, SQLite, Sponge, mysql.
at /remote/users/sasahu/public_html/dashboard/test.cgi line 47
I think DBI->connect will use the DBD::Oracle package for Oracle connection, which works fine in unix terminal, but in the browser it gives the above error.
Could anybody please say how to resolve the problem. Thanks in Advance.
@INCwith the one you get fromperl -Vin the shell?@$connection_details[0](and the following four lines) are far less confusingly written as$connection_details->[0]. Or perhaps combine them all asmy ($AMDORA_TNS_FM, $AMDORA_USER_FM, $AMDORA_PASSWORD_FM, $AMDORA_SCHEMA_FM, $AMDORA_SERVICE_FM) = @$connection_details.