Hello there. I am having a problem that I simply cannot solve. Here are the basics of my system:
FreeBSD 4.5 postgresql 7 DBD-Pg-1.13 Apache 1.3.24 With that said, I have been using postgres for a while now. No issues there. I have also been using the DBD::Pg for a while now, executing my scripts in their directories, with ./script.pl. They run fine. I have no trouble interacting with the database this way. The problem comes when I try to run a similar script from the web. For example, here is a script I am trying to run, as simple as it is: ############################ #!/usr/bin/perl5 use DBI; use DBD::Pg; print "Content-type: text/html\n\n"; print "hi"; ############################ When I run that on the server, with ./, it executes just fine. It prints just what it is supposed to print. However, when I try to run it from the web, it does not work. As some background, I have Apache running just fine. If I remove the "use DBD::Pg;" from the script, it runs from the web just fine. The directory from which I am running the script is set to allow execution of .pl files. It's only when I add that one line, the line I need, "use DBD::Pg;" that it fails on me. Here is the error message from apache logs: ------------------------------------------------- Can't load '/usr/local/lib/perl5/site_perl/5.005/i386-freebsd/auto/DBD/Pg/Pg.so' for module DBD::Pg: Shared object "libpq.so.2" not found at /usr/libdata/perl/5.00503/DynaLoader.pm line 169. at /usr/local/apache/htdocs/test.pl line 4 BEGIN failed--compilation aborted at /usr/local/apache/htdocs/test.pl line 4. [Sun May 26 17:10:26 2002] [error] [client 207.5.142.8] Premature end of script headers: /usr/local/apache/htdocs/test.pl ------------------------------------------------- libpq.so.2 exists in /usr/local/pgsql/lib/, right where it belongs. I tried it with just "Use DBI;", it it worked. However, then I went on to try to perform some actions on my database. I ran the following script: ############################# #!/usr/bin/perl5 use DBI; my $database="dbi:Pg:dbname=testtrak"; my $username="postgres"; my $auth="pgsql"; $dbh = DBI->connect($database,$username,$auth) || die "Cant Connect",DBI::errstr; $sth = $dbh->prepare( " SELECT * from GROUPS " ); $sth->execute(); print "Content-type: text/html\n\n"; print "hi"; ############################# Again, when run from a command line, with ./ it runs fine, and prints just what it should. No errors, no problems. Then go and run it from the web, and this time, the error is: ------------------------------------------------- install_driver(Pg) failed: Can't load '/usr/local/lib/perl5/site_perl/5.005/i386-freebsd/auto/DBD/Pg/Pg.so' for module DBD::Pg: Shared object "libpq.so.2" not found at /usr/libdata/perl/5.00503/DynaLoader.pm line 169. at (eval 1) line 3 Perhaps a required shared library or dll isn't installed where expected at /usr/local/apache/htdocs/test.pl line 10 [Sun May 26 17:41:37 2002] [error] [client 207.5.142.8] Premature end of script headers: /usr/local/apache/htdocs/test.pl ------------------------------------------------- I'm stuck. I have set the following ENV's: POSTGRES_LIB /usr/local/pgsql/lib/ POSTGRES_INCLUDE /usr/local/pgsql/include/ As that was all I could go on. I have rebooted my server, restarted my apache and postgres servers. I can't imagine what the problem could be. I find nothing useful in any searching I do on goodle. The problem only happens when the script is being run through Apache, meaning, when I run it from the web. However, normal scripts run fine from the web, it's just when I add the DBD::Pg does it fail. It never fails when being run from a command line. Can anyone assist with this? I've spent hours on it, and have come no closer to a solution. Thank you, -Dan
