Обсуждение: Postgres' DBI(Pg) problem

Поиск
Список
Период
Сортировка

Postgres' DBI(Pg) problem

От
"Nikos Kapsalis"
Дата:
Hi !
 
I have installed :
 
PostgreSQL 7.0
+ DBI and DBD::Pg

+ the environment vars : LD_LIBRARY_PATH and PGLIB are set to my ./pgsql/lib directory
+ Apache 1.3.22 without "mod_perl" installed
 
When I write a program like :
 
#!/bin/perl -w
 
use DBI;my $dbh, $sth;
$dbh = DBI->connect("dbi:Pg:dbname=researchdb") or die $DBI::errstr;$sth = $dbh->prepare("insert into course
values('$v1','$v2')") or die $DBI::errstr; 
...
...
...
That runs perfect.
 
 
When I am trying to write a CGI script like this which will run under apache :
 

#!/bin/perl -w
use strict;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
use DBI;
my $dbh, $sth, $query;
$query = new CGI;
$dbh = DBI->connect("dbi:Pg:dbname=researchdb") or die $DBI::errstr;$sth = $dbh->prepare("insert
into answersvalues('test1', 'test2');") or die $DBI::errstr; 
..
print $query->header( ....
..
..
 
It gives me the following error in the browser.
 
install_driver(Pg) failed: [Thu Nov 15 12:09:30 2001] writeAnswers: [Thu Nov 15 12:09:30 2001] writeAnswers: Can't load
'/usr/lib/perl5/site_perl/i386-linux/auto/DBD/Pg/Pg.so'for module DBD::Pg: File not found at
/usr/lib/perl5/i386-linux/DynaLoader.pmline 169. [Thu Nov 15 12:09:30 2001] writeAnswers: [Thu Nov 15 12:09:30 2001]
writeAnswers:[Thu Nov 15 12:09:30 2001] writeAnswers: [Thu Nov 15 12:09:30 2001] writeAnswers: at (eval 11) line 3
Perhapsa required shared library or dll isn't installed where expected at /home/pcguest/sambaShare/cgi-bin/MR.pm line
12 
 
-- (Just to know : "writeAswers" is a function which calls the "use DBI;" in the "MR.pm" file )
-- Any idea how to solve that problem ?
 Get your FREE download of MSN Explorer at http://explorer.msn.com

Re: Postgres' DBI(Pg) problem

От
Tommi Mäkitalo
Дата:
Hi

did you set your LD_LIBRARY_PATH in your apache-config? You should put a "SetEnv LD_LIBRARY_PATH (wherever your . is)/pgsql/lib). And reload or restart apache of course.


Tommi


Nikos Kapsalis wrote:
Hi !
 
I have installed :
 
PostgreSQL 7.0
+ DBI and DBD::Pg
+ the environment vars : LD_LIBRARY_PATH and PGLIB are set to my ./pgsql/lib directory
+ Apache 1.3.22 without "mod_perl" installed
 
When I write a program like :
 
#!/bin/perl -w
 
use DBI;
my $dbh, $sth;
$dbh = DBI->connect("dbi:Pg:dbname=researchdb") or die $DBI::errstr;
$sth = $dbh->prepare("insert into course values('$v1', '$v2')") or die $DBI::errstr;
...
...
...
That runs perfect.
 
 
When I am trying to write a CGI script like this which will run under apache :
 
#!/bin/perl -w
use strict;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
use DBI;
my $dbh, $sth, $query;
$query = new CGI;
$dbh = DBI->connect("dbi:Pg:dbname=researchdb") or die $DBI::errstr;
$sth = $dbh->prepare("insert into answers values('test1', 'test2');") or die $DBI::errstr;
..
print $query->header( ....
..
..
 
It gives me the following error in the browser.
 
install_driver(Pg) failed: [Thu Nov 15 12:09:30 2001] writeAnswers: [Thu Nov 15 12:09:30 2001] writeAnswers : Can't load '/usr/lib/perl5/site_perl/i386-linux/auto/DBD/Pg/Pg.so' for module DBD::Pg: File not found at /usr/lib/perl5/i386-linux/DynaLoader.pm line 169. [Thu Nov 15 12:09:30 2001] writeAnswers: [Thu Nov 15 12:09:30 2001] writeAnswers: [Thu Nov 15 12:09:30 2001] writeAnswers: [Thu Nov 15 12:09:30 2001] writeAnswers : at (eval 11) line 3 Perhaps a required shared library or dll isn't installed where expected at /home/pcguest/sambaShare/cgi-bin/MR.pm line 12
 
-- (Just to know : "writeAswers" is a function which calls the "use DBI;" in the "MR.pm" file )
-- Any idea how to solve that problem ?
 


Get your FREE download of MSN Explorer at http://explorer.msn.com