Re: failed: ERROR OCIEnvNlsCreate. Check (everything)

[email protected] (Alexander Foken)
Newsgroups perl.dbi.users
Message-ID <[email protected]>
On 07.04.2010 10:45, Martin Evans wrote:
> Perl Diety wrote:
>   
>> ENV VARS
>>
>> DOCUMENT_ROOT = /var2/www/html
>> GATEWAY_INTERFACE = CGI/1.1
>> HTTP_ACCEPT = */*
>> HTTP_ACCEPT_ENCODING = gzip, deflate
>> HTTP_ACCEPT_LANGUAGE = en-us
>> HTTP_HOST = ournode.com
>> HTTP_UA_CPU = x86
>> HTTP_USER_AGENT = Mozilla/4.0
>> LD_LIBRARY_PATH = /export/apps/oracle/product/10201/lib
>> LD_RUN_PATH = /export/apps/oracle/product/10201/lib
>> NLS_LANG = en_GB.UTF-8
>> ORACLE_BASE = /export/apps/oracle
>> ORACLE_HOME = /export/apps/oracle/product/10201
>> ORA_NLS10 = /export/apps/oracle/product/10201/nls/data/
>> REQUEST_METHOD = GET
>> REQUEST_URI = /cgi-bin/oratest.cgi
>> SERVER_PORT = 80
>> SERVER_PROTOCOL = HTTP/1.1
>> SERVER_SIGNATURE =
>>
>> Apache/2.0.52 (Red Hat) Server at ournode.com Port 80
>>
>> SERVER_SOFTWARE = Apache/2.0.52 (Red Hat)
>> DBI connect(...) failed: ERROR OCIEnvNlsCreate. Check ORACLE_HOME (Linux)
>> env var or PATH (Windows) and or NLS settings, permissions, etc. at
>> /cgi-bin/oratest.cgi line 32
>>     

This looks roughly like a CGI enviromnent, and the Oracle Variables seem 
to be set. But lots of variables seem to be missing, like PATH and some 
variabes starting with HTTP_, SERVER_, SCRIPT_, and REQUEST_. And the 
LD_xxx variables shouldn't be there.

If this is the *complete* environment provided to the CGI, something is 
*very* wrong with the Apache.

If not, post a complete dump of %ENV in CGI context, e.g. with the 
printenv script that came with Apache:

#!/usr/local/bin/perl
##
##  printenv -- demo CGI program which just prints its environment
##

print "Content-type: text/plain; charset=iso-8859-1\n\n";
foreach $var (sort(keys(%ENV))) {
    $val = $ENV{$var};
    $val =~ s|\n|\\n|g;
    $val =~ s|"|\\"|g;
    print "${var}=\"${val}\"\n";
}

>>     
>
> Did you really set AND export ORACLE_HOME or LD_LIBRARY_PATH such that
> Apache children see them? I can't remember what the syntax in the
> httpd.conf file is now (SetEnv perhaps) as I no longer use Apache but
> you used to have to explicitly tell Apache which env vars to allow.
>
> Martin
>   
Two ways:

1. PassEnv VariableName [...] -- see 
<http://httpd.apache.org/docs/2.2/mod/mod_env.html#passenv>
2. SetEnv VariableName Value -- see 
<http://httpd.apache.org/docs/2.2/mod/mod_env.html#setenv>

I prefer PassEnv over SetEnv when the variables already exist in the 
environment of the process invoking the Apache server. That way, I don't 
have to change the Apache configuration when an environment variable 
changes. I use SetEnv only to set additional variables that must not 
appear in the environment of the process invoking the Apache server.

See also 
<http://alexander-foken.de/Censored%20copy%20of%20Oracle%20Troubleshooter%20HOWTO.html>

Alexander

-- 
Alexander Foken
mailto:[email protected]  http://www.foken.de/alexander/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.