freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: Gaurav Nangia <gnangia AT dtcc.com>
- To: FreeTDS AT lists.ibiblio.org
- Subject: [freetds] freetds with DBD::Sybase using Apache
- Date: Mon, 23 Feb 2009 11:31:06 -0500
I am using the DBD::Sybase module (v1.07) with freetds 0.63 in a cgi
script that is launched from an Apache webserver. The cgi-script works
fine from the command line where it is able to use the DBD module to
connect to the backend database and provide the output from the DB.
However, when I run it from the Apache webserver, it complains with the
following errors -
[Mon Feb 23 11:22:09 2009] [error] [client 172.22.88.176]
install_driver(Sybase) failed: Can't load
'/usr/local/lib/perl5/site_perl/5.8.3/sun4-solaris/auto/DBD/Sybase/Sybase.so'
for module DBD::Sybase: ld.so.1: /usr/local/bin/perl: fatal:
libgcc_s.so.1: open failed: No such file or directory at
/usr/local/lib/perl5/5.8.3/sun4-solaris/DynaLoader.pm line 229.
[Mon Feb 23 11:22:09 2009] [error] [client 172.22.88.176] at (eval 3)
line 3
[Mon Feb 23 11:22:09 2009] [error] [client 172.22.88.176] Compilation
failed in require at (eval 3) line 3.
[Mon Feb 23 11:22:09 2009] [error] [client 172.22.88.176] Perhaps a
required shared library or dll isn't installed where expected
[Mon Feb 23 11:22:09 2009] [error] [client 172.22.88.176] at
/opt/apache/cgi-bin/dmz_summary.cgi line 25
[Mon Feb 23 11:22:09 2009] [error] [client 172.22.88.176] Premature end of
script headers: dmz_summary.cgi
Here is a copy of the script -
!/usr/local/bin/perl
BEGIN
{
$ENV{'SYBASE'} = "/usr/local/freetds";
$ENV{'LD_LIBRARY_PATH'} =
"/usr/lib:/usr/local/lib:/usr/local/freetds/lib:/opt1/netcool/platform/solaris2/lib";
$ENV{'SHLIB_PATH'} =
"/usr/lib:/usr/local/lib:/usr/local/freetds/lib:/opt1/netcool/platform/solaris2/lib";
$ENV{'LIBPATH'} ="/opt1/netcool/platform/solaris2/lib";
}
use DBI;
use strict;
use warnings;
my $log = "/tmp/gntest";
open(LOG, "> $log");
my $objectserver = "DEVPNCOMS";
my $user = "xxxx";
my $password = "yyyy";
my $omni_dbh = DBI->connect("dbi:Sybase:server=$objectserver", "$user",
"$password", {PrintError => 0});
if (!$omni_dbh)
{
#exit 1;
}
print LOG "Connected to primary objectserver: $objectserver\n";
my $sth = $omni_dbh->prepare("select count(Node) from alerts.status");
my $total = 0;
if($sth->execute)
{
while (my $res = $sth->fetchrow_arrayref)
{
$total = $res->[0];
}
}
print LOG "Total is $total\n";
close(LOG);
$omni_dbh->disconnect();
print "Content-type: text/html\n\n";
print <<__HTML__;
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>DMZ Status</title>
</head>
<body>
__HTML__
print "<p>Total: $total</p>";
print <<__HTML__;
</body>
</html>
__HTML__
======================================
When I run from command line, here is what I get -
tmebatp4:root:/opt/apache/cgi-bin>./dmz_summary.cgi
Content-type: text/html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>DMZ Status</title>
</head>
<body>
<p>Total: 458</p></body>
</html>
=============================
Any help would be appreciated.
Regards,
Gaurav Nangia
The Depository Trust & Clearing Corporation
Management and Network Security
(212) 855 - 2317
-----------------------------------------
________________________________________________________
DTCC DISCLAIMER: This email and any files transmitted with it are
confidential and intended solely for the use of the individual or
entity to whom they are addressed. If you have received this email
in error, please notify us immediately and delete the email and any
attachments from your system. The recipient should check this email
and any attachments for the presence of viruses. The company
accepts no liability for any damage caused by any virus transmitted
by this email.
- [freetds] freetds with DBD::Sybase using Apache, Gaurav Nangia, 02/23/2009
Archive powered by MHonArc 2.6.24.