Thread: DBI and Pg error

DBI and Pg error

From
jim
Date:
Some friends said this list is the best place to ask my questions regarding
BSDI/postgresql/DBI because some of you are BSDI expertises.

Basically, I installed postgresql, DBI and Pg and test it. My script works fine
locally and doesn't work as a CGI. I already asked several lists but so far I 
can not fix it.

I run as root user in my BSDI 4.1/Apache 1.3.9 server.  My perl is 5.005_03 
My postgresql 6.5.3 was installed  in the default location: /usr/local/pgsql 
I run postmaster with -i option. Actually I use  su - postgres in my rc.local file 
to run postmaster automatically when the server startup. I also setup .bashrc 
.bash_profile with the required env variables setup in both  postgres and 
root home.

For the database access, I include following several line in my pg_hba.conf 
file to make it works with every one.

host        all                                                 trust
host        all        127.0.0.1        255.255.255.255         trust 
host         all        0.0.0.0                0.0.0.0                        trust

I install DBI 1.13 and DBD:Pg 0.93 with no error message follow exactly the 
README.  All test was passed.

I created a testing database, a testing table and insert some records.
I use some perl scripts to test it. The script works locally and retrieve all the 
records from the table. When I run it as a cgi, it doesn't work. When I didn't 
set the required env variables, locally I get the same error message. That's 
why I guess it could be an env variable problem.  (If the DBI/DBD is not installed
correct, why it works locally??? !!!) I have tried to set the ENV with CGI, the 
problem is still. The error message is always the same as below:

install_driver(Pg) failed" Can't load '/usr/libdata/perl5/site_perl/i386-bsdos/auto/DBD/Pg/Pg.so'
for module DBD::Pg: File not found at /usr/libdata/perl5/5.00503/i386-bsdos/DynaLoader.pm line 169. 

I checked the two files, they all exist! 

I got confused here. I can not figure out what's wrong. Some friend from the list said this 
may be a installation problem and I need to reinstall perl. But  why the DBI works fine locally 
but not cgi.

Sorry for post so long here. But it's really important to me and I have to fix it ASAP!!!. 
Any repsonse is very thankful.

Jim




Re: DBI and Pg error

From
Tom Lane
Date:
jim <info@online411.com> writes:
> install_driver(Pg) failed" Can't load '/usr/libdata/perl5/site_perl/i386-bsdos/auto/DBD/Pg/Pg.so'
> for module DBD::Pg: File not found at /usr/libdata/perl5/5.00503/i386-bsdos/DynaLoader.pm line 169. 

> I checked the two files, they all exist! 

Dynamic library loaders are notorious for the poor quality of their
error messages :-(.  I'll bet that the file that's not being found is
not either of the files mentioned above, but a shared library that they
depend on.  In other words, either libpq.so or a library that it depends
on in turn.  Since it works for you locally, a good bet is that your CGI
environment doesn't have the right setting of LD_LIBRARY_PATH (or
whatever environment variable determines shared-library search path
on your platform).
        regards, tom lane