PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: "Ed Avis" <eda at waniasset dot com>
Subject: DBD::Sybase with FreeTDS on Linux works, but fails when run under Apache
Date: Jun 1 2007 3:32PM

I am using Fedora Linux 6, with FreeTDS 0.64, and DBD::Sybase 1.08.  The following test program works:

#!/usr/bin/perl
use warnings;
use strict;
use DBI;
use Data::Dumper;
print Dumper \%ENV;

%ENV = ();

my $dbh = DBI->connect('dbi:Sybase:WCL-SQL-TEST', 'WaniSystems', 'password',
		       { RaiseError => 1, AutoCommit => 1,
			 FetchHashKeyName => 'NAME_lc' });
my @rows = @{$dbh->selectall_arrayref('select count(*) from tbinstruments')};
print Dumper \@rows;
disconnect $dbh;

However, when I do the same DBI connection from a CGI script running under Apache I get an error like

DBI connect('WCL-SQL-TEST','WaniSystems',...) failed: (no error string) at /var/www/cgi-bin/test line 34

I have tried exec()ing the test program from inside my CGI script and the same error occurs.  However, if I sudo to the apache user and run the test program from the command line then it works.  I can't think what is causing the difference - as you see I empty the environment first to rule that out.

Any suggestions?  I have tried to trace through the DBI code to see what is happening but I got lost at the point where DBD::Sybase calls DBD::Sybase::db::_login, which I couldn't find.

-- 
Ed Avis 

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________