in reply to Re^4: DBD::Sybase make problem
in thread DBD::Sybase make problem

When executing the script from the command line, don't run it as root but as the user your webserver runs as. You will find that likely only root has the proper permissions to read/load/execute the shared libraries.

Replies are listed 'Best First'.
Re^6: DBD::Sybase make problem
by ashok.g (Beadle) on Jul 19, 2010 at 14:31 UTC
    I have changed the permissions of /usr/local/freetds/lib to all executable. Even then the output is the same.... :(
      echo $LD_LIBRARY_PATH
      ldd Sybase.so
      ldd libct.so.4
      

        OK. Sybase.so is missing in my $LD_LIBRARY_PATH.
        Now, I copied that library found from /tmp/DBD-Sybase-1.10/blib/arch/auto/DBD/Sybase/ to /usr/local/freetds/lib and set all the dependency libraries in $LD_LIBRARY_PATH and all those libraries have execute permissions by all.
        Here is the code after some changes:

        #!/usr/bin/perl #require "dbdsybase.pl"; BEGIN { $ENV{'SYBASE'} = '/usr/local/freetds'; $ENV{'LD_LIBRARY_PATH'} = '/usr/local/freetds/lib/:/lib/:/lib/tls/'; #$ENV{'USER'} = 'root'; } use CGI; use CGI::Carp; use DBI; my $cgi = new CGI(); print $cgi->header(); my $cgi = new CGI(); my $path='/opt/ash/netcool'; my $hostname="192.168.2.95"; my $portno="4100"; my $database_name="NCOMS"; my $db_username="root"; my $db_password="access"; print <<EOF; <html> <head> <title>DBD Sybase Connection Check</title> </head> <body> <form name="myform"> EOF foreach (sort keys %ENV) { if (($_ eq 'SYBASE')||($_ eq 'LD_LIBRARY_PATH')||($_ eq 'USER' +)) { print "$_ : $ENV{$_}<br>"; } } $ldd1=`ldd /usr/local/freetds/lib/Sybase.so`; $ldd2=`ldd /usr/local/freetds/lib/libct.so.4`; print "<h2>ldd of Sybase.so:</h2> $ldd1 <br> <h2>ldd of libct.so.4:</h +2> $ldd2 <br>"; #print "\nSyabse:$ENV{'SYBASE'}<br>LD_LIBRARY_PATH:$ENV{'LD_LIBRARY_PA +TH'}<br>"; print "<h2>**********----->$dbh<-----**********</h2>"; my $dbh = DBI->connect("dbi:Sybase:host=$hostname;port=$portno;server= +$database_name;",$db_username,$db_password) || warn "Database Connect +ion not made: $DBI::errstr"; #my $dbh = &datahandle(); print "<h2>**********$dbh**********</h2><br>"; print <<EOF; <br> </form> </body> </html> EOF
        and its output on browser is:
        LD_LIBRARY_PATH : /usr/local/freetds/lib/:/lib/:/lib/tls/ SYBASE : /usr/local/freetds ldd of Sybase.so: libct.so.4 => /usr/local/freetds/lib/libct.so.4 (0x00e92000) libdl.so. +2 => /lib/libdl.so.2 (0x00fae000) libm.so.6 => /lib/tls/libm.so.6 (0x +00402000) libc.so.6 => /lib/tls/libc.so.6 (0x00604000) librt.so.1 => +/lib/tls/librt.so.1 (0x00a13000) libpthread.so.0 => /lib/tls/libpthre +ad.so.0 (0x008c6000) /lib/ld-linux.so.2 (0x0093f000) ldd of libct.so.4: librt.so.1 => /lib/tls/librt.so.1 (0x00a8c000) libpthread.so.0 => /lib +/tls/libpthread.so.0 (0x009be000) libc.so.6 => /lib/tls/libc.so.6 (0x +00111000) /lib/ld-linux.so.2 (0x0093f000) **********-----><-----**********
        Still I'm not getting the dbi connection.
        You didn't address the problem why $DBI::errstr is not printing in the script.

        Thanks in advance.