You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Yanick Quirion <YQ...@tranzyme.com> on 2007/04/27 14:39:39 UTC

[users@httpd] RHEL 5 x86_64, Oracle 10g 64 bit, apache 2.2 and DBD:Oracle

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 = webmaster@domain.com
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



RE: [users@httpd] RHEL 5 x86_64, Oracle 10g 64 bit, apache 2.2 and DBD:Oracle

Posted by Yanick Quirion <YQ...@tranzyme.com>.
Hi!

I found the problem and I would like to share it with you.

For an unknown reason it seems that Oracle 10g (10.2.0) has not set read
access for "other" group. I tried to run my apache server as "oracle" user
and it works. Then after, I put back defaulr user for apache, but add this
user (apache) to the oinstall group and it also works.

I don't know what is the file that was unreadable before. If somebody knows
I will be happy to know this folder/filename.

Thank you again for your help.

Regards,

_____________________________________
Yanick Quirion
Network & System Administrator
Tranzyme Pharma Inc.
 
(819) 820-6840 (phone)
(819) 820-6855 (direct)
(819) 820-6841 (fax)
(819) 570-6855 (mobile)
 
YQuirion@tranzyme.com
www.tranzyme.com
 

-----Original Message-----
From: jslive@gmail.com [mailto:jslive@gmail.com] On Behalf Of Joshua Slive
Sent: 27 April, 2007 09:23
To: users@httpd.apache.org
Subject: Re: [users@httpd] RHEL 5 x86_64, Oracle 10g 64 bit, apache 2.2 and
DBD:Oracle

On 4/27/07, Yanick Quirion <YQ...@tranzyme.com> wrote:

> 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 ...

I'd guess that it isn't going to work to set those variable inside the
perl script, since the oracle stuff gets initialized before the
variables are set.

Instead, you should try setting them in the environment that apache is
run under. An easy way to do that is to add them to the envvars script
in the apache binary directory (assuming a standard install).

Joshua.


>
> 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 = webmaster@domain.com
> 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
>
>
>
>

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] RHEL 5 x86_64, Oracle 10g 64 bit, apache 2.2 and DBD:Oracle

Posted by Joshua Slive <jo...@slive.ca>.
On 4/27/07, Yanick Quirion <YQ...@tranzyme.com> wrote:

> 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 ...

I'd guess that it isn't going to work to set those variable inside the
perl script, since the oracle stuff gets initialized before the
variables are set.

Instead, you should try setting them in the environment that apache is
run under. An easy way to do that is to add them to the envvars script
in the apache binary directory (assuming a standard install).

Joshua.


>
> 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 = webmaster@domain.com
> 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
>
>
>
>

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org