Click here to get back home

Problem with DBD::Oracle in cgi-script

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Problem with DBD::Oracle in cgi-script Marc F. Neininger 08-28-2007
Posted by Marc F. Neininger on August 28, 2007, 3:15 am
Please log in for more thread options


Hello,
I'm trying to make an Oracle 10g EE DB accessible via web-interface.
The perl-scripts that are run from console do work properly, but I don't
achieve in connecting to the database from the cgi-scripts.

Does anybody have a clue where I have to look?
Apache is working, perl is working, dynamic sites are working, DB is
working but all the four together seem to have difficulties :-(

System is Debian stable.

TIA

Marc

Posted by Gunnar Hjalmarsson on August 28, 2007, 4:38 am
Please log in for more thread options


Marc F. Neininger wrote:
> Hello,
> I'm trying to make an Oracle 10g EE DB accessible via web-interface.
> The perl-scripts that are run from console do work properly, but I don't
> achieve in connecting to the database from the cgi-scripts.
>
> Does anybody have a clue where I have to look?

Check the error message(s) in the server's error log.

> Apache is working, perl is working, dynamic sites are working, DB is
> working but all the four together seem to have difficulties :-(

Permissions problem, perhaps? The CGI scripts may be run as some other
user than when you run Perl from command line (unless suEXEC or
something like it has been enabled).

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

Posted by Jonathan Leffler on August 29, 2007, 2:02 am
Please log in for more thread options


Marc F. Neininger wrote:
> I'm trying to make an Oracle 10g EE DB accessible via web-interface.
> The perl-scripts that are run from console do work properly, but I don't
> achieve in connecting to the database from the cgi-scripts.
>
> Does anybody have a clue where I have to look?
> Apache is working, perl is working, dynamic sites are working, DB is
> working but all the four together seem to have difficulties :-(
>
> System is Debian stable.


It's an odds-on bet that the problem is environment variables.

Database + "works at command line" + "does not work in web"
== environment.

Look up PassEnv and SetEnv in Apache - equivalents elsewhere.

--
Jonathan Leffler #include <disclaimer.h>
Email: jleffler@earthlink.net, jleffler@us.ibm.com
Guardian of DBD::Informix v2007.0826 -- http://dbi.perl.org/

Posted by Marc F. Neininger on August 29, 2007, 4:17 am
Please log in for more thread options


Jonathan Leffler schrieb:

> It's an odds-on bet that the problem is environment variables.
>
> Database + "works at command line" + "does not work in web"
> == environment.
>
> Look up PassEnv and SetEnv in Apache - equivalents elsewhere.

That's one of the problems. For Oracle you have to set the ORACLE_SID
and ORACLE_HOME variables for the calling shell (aka Apache Environment).

I set those variables via $Env und $Env in the
script before connecting to the DB but the problem might be deeper
inside. The driver links against an Oracle lib that is not found at
runtime. So I compiled the driver another time and got some mistakes like

...
Constant subroutine _POSIX_C_SOURCE undefined at
/usr/lib/perl/5.8/features.ph line 50.
Constant subroutine _XOPEN_SOURCE undefined at
/usr/lib/perl/5.8/features.ph line 52.
Constant subroutine _XOPEN_SOURCE_EXTENDED undefined at
/usr/lib/perl/5.8/features.ph line 54.
... .

But the problem seems to be a lib. Now I'm looking which one it might
be. It looks to me as if I would link against some outdated libraries.
But the system is set up 3 weeks ago and patched. :-(

I ignored those errorlines and installed the driver eventhough.
Afterwards I was (and still am) able to connect to the DB via Script and
question the DB all stuff. But with the same set of commands in a script
that is executed via Apache I get the following error output:

install_driver(Oracle) failed: Can't load
'/usr/local/lib/perl/5.8.8/auto/DBD/Oracle/Oracle.so' for module
DBD::Oracle: libclntsh.so.10.1: cannot open shared object file: No such
file or directory at /usr/lib/perl/5.8/DynaLoader.pm line 225.
at (eval 4) line 3 .

Sorry for my confusing answer but I really am confused...

Marc

Posted by Peter Scott on August 29, 2007, 6:46 am
Please log in for more thread options


On Wed, 29 Aug 2007 10:17:32 +0200, Marc F. Neininger wrote:
> But the problem seems to be a lib. Now I'm looking which one it might
> be. It looks to me as if I would link against some outdated libraries.
> But the system is set up 3 weeks ago and patched. :-(
>
> I ignored those errorlines and installed the driver eventhough.
> Afterwards I was (and still am) able to connect to the DB via Script and
> question the DB all stuff. But with the same set of commands in a script
> that is executed via Apache I get the following error output:
>
> install_driver(Oracle) failed: Can't load
> '/usr/local/lib/perl/5.8.8/auto/DBD/Oracle/Oracle.so' for module
> DBD::Oracle: libclntsh.so.10.1: cannot open shared object file: No such
> file or directory at /usr/lib/perl/5.8/DynaLoader.pm line 225.
> at (eval 4) line 3 .

Just passing by. Maybe check LD_LIBRARY_PATH and LD_RUN_PATH?

--
Peter Scott
http://www.perlmedic.com/
http://www.perldebugged.com/


Similar ThreadsPosted
Problem installing DBD-Oracle June 5, 2008, 5:44 pm
Perl DBI Oracle Problem with Apache 2.0.46 January 19, 2005, 2:29 am
Problem building DBD::Oracle on 64 bit solaris April 13, 2005, 2:51 pm
DBD::Oracle and various oracle clients August 1, 2006, 9:23 am
DBD::Oracle June 15, 2006, 3:22 am
DBD::Oracle on cygwin July 12, 2006, 6:09 am
DBD::Oracle issues January 23, 2007, 7:16 pm
DBI/DBD-Oracle and Proxy June 13, 2007, 11:43 am
Using DBD::pNET with DBD::Oracle August 23, 2007, 8:54 pm
DBI and DBI::Oracle packages configuration July 22, 2004, 8:55 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap