Dear all, I'm currently experiencing a strange problem with Oracle:DBD and Apache 2.2 on a 64 bit Redhat Enterprise system.
I have a small script:
============================================================================
=========
#!/usr/bin/perl
use DBI;
# Environmental variables used by Oracle
$ENV{DBI_USER} = "phone";
$ENV{DBI_PASS} = "123456";
$ENV{DBI_DSN} = "DBI:Oracle:host=oracle.domain.com;sid=db1;port=1522";
$ENV{ORACLE_HOME} = "/usr/app/oracle/product/10.2.0";
my $dbh = DBI->connect(undef,undef,undef,
);
my $sql = "select last_name ";
$sql .= "from phone.phone ";
# prepare and execute the query
my $sth = $dbh->prepare($sql);
$sth->execute();
# set up variables for each column SELECTed
my ($last_name);
$sth->bind_columns(\$last_name);
print "Content-type: text/html\n\n";
while($sth->fetch()) {
print "$last_name\n";
}
============================================================================
=========
When I ran it from the command prompt it works great:
[callisto]:/u/Intranet/cgi-bin# ./toto.pl
Content-type: text/html
Quirion
Beaubien
Beauchemin
Benakli
Nelson
Bhérer
Champagne
Garg
Berthiaume
Chamblin
...
This tells me that my Oracle configuration is fine and that perl Oracle:DBD
is working also.
The problem appear when I ran the script from a web browser. On my browser,
I enter http://www.domain.com/cgi-bin/toto.pl and I got the following error
into error_log:
ERROR OCIEnvNlsCreate. Check ORACLE_HOME env var, NLS settings, permissions,
etc. at ...
On my script I clearly define all necessary environment variables. To make
sure the environment are correctly set, I create another small script:
============================================================================
=========
#!/usr/bin/perl
use DBI;
use DBD::Oracle;
# Environmental variables used by Oracle
$ENV{DBI_USER} = "phone";
$ENV{DBI_PASS} = "123456";
$ENV{DBI_DSN} = "DBI:Oracle:host= oracle.domain.com;sid=db1;port=1522";
$ENV{ORACLE_HOME} = "/usr/app/oracle/product/10.2.0";
print "Content-type: text/html\n\n";
print "<tt>\n";
foreach $key (sort keys(%ENV)) {
print "$key = $ENV{$key}<p>";
}
exit;
============================================================================
=========
And the result from my web browser is next:
DBI_DSN = DBI:Oracle:host=oracle.domain.com;sid=db1;port=1522 <---
DBI_PASS = 123456 <---
DBI_USER = phone <---
DOCUMENT_ROOT = /u/Intranet
GATEWAY_INTERFACE = CGI/1.1
HTTP_ACCEPT = image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
application/x-shockwave-flash, application/vnd.ms-excel,
application/vnd.ms-powerpoint, application/msword, application/xaml+xml,
application/vnd.ms-xpsdocument, application/x-ms-xbap,
application/x-ms-application, */*
HTTP_ACCEPT_ENCODING = gzip, deflate
HTTP_ACCEPT_LANGUAGE = en-ca
HTTP_CONNECTION = Keep-Alive
HTTP_COOKIE =
GinkgoConfig=autoRefresh:0¤tPage:ms-dactl.php%3Findex%3D1&showHelpIcon:yes¤t
Submenu:SUBFRAME.TPL%3FcurrentSubmenu%3D/hmastor/ms-damnu.php%26index%3D1;
keepusername_db=yanqui%3Aon%3Aswitch
HTTP_HOST = callisto.tranzyme.com
HTTP_UA_CPU = x86
HTTP_USER_AGENT = Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET
CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)
ORACLE_HOME = /usr/app/oracle/product/10.2.0 <---
PATH = /sbin:/usr/sbin:/bin:/usr/bin
QUERY_STRING =
REMOTE_ADDR = 2.2.2.2
REMOTE_HOST = toto.domain.com
REMOTE_PORT = 19895
REQUEST_METHOD = GET
REQUEST_URI = /cgi-bin/toto.pl
SCRIPT_FILENAME = /u/Intranet/cgi-bin/toto.pl
SCRIPT_NAME = /cgi-bin/toto.pl
SERVER_ADDR = 10.32.2.10
SERVER_ADMIN = [EMAIL PROTECTED]
SERVER_NAME = www.domain.com
SERVER_PORT = 80
SERVER_PROTOCOL = HTTP/1.1
SERVER_SIGNATURE = Apache/2.2.3 (Red Hat) Server at www.domain.com Port 80
SERVER_SOFTWARE = Apache/2.2.3 (Red Hat)
============================================================================
==================
I highlight all variable that I set from my script using <----.
I don't understand why the script doesn't work from a web page. I have a
similar setup on a EHRL 4 32 bit and it works great. I tried to downgrade
Oracle:DBD but it didn't change anything.
Is somebody can help me with that?
Best Regards,
Yanick Quirion
smime.p7s
Description: S/MIME cryptographic signature
