OCIEnvNlsCreate() failed

Alles, was PHP betrifft, kann hier besprochen werden.

OCIEnvNlsCreate() failed

Postby kboarder » 05. March 2009 17:26

OCIEnvNlsCreate() failed. There is something wrong with your system - please check that PATH includes the directory with Oracle Instant Client Libraries.

I just installed Oracle 10g Client. Is this still not right? Very Frustrated.

Thanks in advance.

Kim
kboarder
 
Posts: 1
Joined: 03. March 2009 19:16

Re: OCIEnvNlsCreate() failed

Postby KingCrunch » 28. March 2009 03:13

There is an english subforum below

"PATH" is meant to be an environment variable. How to set r changed is surely mentioned in your OS-Manual.
Nicht jeder Fehler ist ein Bug ...
KingCrunch
 
Posts: 1724
Joined: 26. November 2005 19:25

Re: OCIEnvNlsCreate() failed

Postby Izzy » 28. March 2009 03:42

KingCrunch wrote:There is an english subforum below
IMHO, it is permitted to post in this Grundlagen und Wissenswertes section in English - CMIW.
Izzy
 
Posts: 3344
Joined: 25. April 2006 17:06

Re: OCIEnvNlsCreate() failed

Postby philippc » 04. May 2009 21:34

after much pain also attempting to use XAMPP on WinXP and connect to Oracle using the InstantClient with PHP, ... i got it to work (did i mention with great pain?)!

Initial details:
- my linux box is busy with something else so i am currently forced to use winxp on an ibm, uh, lenovo T400.
- download the latest xampp release:
http://www.apachefriends.org/en/xampp-windows.html
- download the latest oracle instant client (requires a login):
http://www.oracle.com/technology/software/tech/oci/instantclient/index.html
- modify C:\xampp\php\php.ini and uncomment/activate the following lines:
extension=php_oracle.dll
extension=php_oci8.dll

- PLEASE NOTE: NO other oracle product is installed on this winxp box
- This also means I have NO tnsnames.ora file, etc.


hi-level steps:
- simply extracted xampp onto c: drive, i.e. c:\xampp\...
- created a php html page: C:\xampp\htdocs\index.php with the following content:

<?php
$db_test = '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.10.10.10)(PORT=1521)) (CONNECT_DATA=(SID=TEST)))';
$c = oci_connect("user", "passwd", $db_test);
$s = oci_parse($c, 'select * from some_table order by some_column');
oci_execute($s);
while ($res = oci_fetch_array($s, OCI_ASSOC)) {
var_dump($res);
}
?>

- attempted to add the instantclient dlls to the windoze PATH and created LD_LIBRARY_PATH, etc. and various place on the box.

So the failed result(s) with the url http://localhost/index.php ...
the following error message would appear:
oci_connect() http://function.oci-connect: OCIEnvNlsCreate() failed.

after searching and reviewing everywhere and basically trying everything (btw, not much help with xampp on winxp for this error, figures... :?: ), this oracle forum thread provided the best hint for the apparent lame fix:
http://forums.oracle.com/forums/thread.jspa?threadID=762528&tstart=0

In summary:
Starting completely OVER (yeah, i got frustrated enough and want a clean start)...
Final details, in reasonable order:
- using winxp sp2
- download the latest xampp release:
http://www.apachefriends.org/en/xampp-windows.html
- extracted xampp onto c: drive, i.e. c:\xampp\...
- modify C:\xampp\php\php.ini and uncomment/activate the following lines:
extension=php_oracle.dll
extension=php_oci8.dll

- (again)PLEASE NOTE: NO other oracle product is installed on this winxp box (oracle clients, etc.)
- (again)This also means I have NO [i]tnsnames.ora
file, etc.
- (lame)Do not bother updating the windoze env PATH (has no effect).
- (lame)Do not both updating the windoze env LD_LIBRARY_PATH either (no effect anyhow).[/i]


- download the latest oracle instant client (requires a login):
http://www.oracle.com/technology/software/tech/oci/instantclient/index.html
- extracted the oracle instantclient to C:\Temp\instantclient-basic-win32-11.1.0.7.0\
- copy the contents only from C:\Temp\instantclient-basic-win32-11.1.0.7.0\instantclient_11_1\* over
to C:\xampp\apache\bin
- start xampp up: c:\xampp\apache_start.bat
- create a php html page to log into oracle called C:\xampp\htdocs\index.php with the previously mentioned php code snippet above:

<?php
$db_test = '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.10.10.10)(PORT=1521)) (CONNECT_DATA=(SID=TEST)))';
$c = oci_connect("user", "passwd", $db_test);
$s = oci_parse($c, 'select * from some_table order by some_column');
oci_execute($s);
while ($res = oci_fetch_array($s, OCI_ASSOC)) {
var_dump($res);
}
?>


- CHECK IT! (drum roll please) browse on over to http://localhost/index.php

voila! with much irritation... JOY! IT WORKS (for me at least)! basically, i was attempting to create an alternative test bed for a reporting project-o-mine using php to connect to oracle for bedazzling reports, etc. hopefully this help someone out there...

-p
philippc
 
Posts: 1
Joined: 04. May 2009 20:03

Re: OCIEnvNlsCreate() failed

Postby jdawson » 08. June 2009 22:46

Thanks philippc, for this suggestion! I also had the OCIEnvNlsCreate() error after reinstalling XAMPP. However... the fix:

"copy the contents only from C:\Temp\instantclient-basic-win32-11.1.0.7.0\instantclient_11_1\* over
to C:\xampp\apache\bin"

Worked for me (also after MUCH PAIN!!... man, I feel your pain!).

Not sure why environment variables were not being picked up.

For a *superior* db to MySQL (???), it's truly astonishing how Oracle has been such a pain in the neck to simply connect! I could have had a whole app developed and delivered using MySQL in the time it has taken me simply to connect to Oracle. (Yet another check in my book for open source!)
jdawson
 
Posts: 1
Joined: 08. June 2009 22:39

Re: OCIEnvNlsCreate() failed

Postby Etdashou » 26. February 2010 18:56

Guys....

I am NOT able to do this and I tried exactly the same thing. The ONLY difference is that:

$db_test = '(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.10.10.10)(PORT=1521)) (CONNECT_DATA=(SID=TEST)))';

If I look on my pc, my tnsnames has (CONNECT_DATA = (SERVICE_NAME = my.server.com)

I don't have this SID.

I tried what you said (copying to apache/bin folder) but I still have OCIEnvNlsCreate() failed error....
My god this is so much pain for a Database connection...

I was wondering, what is your configure command in phpinfo? Here is what I have:

Configure Command cscript /nologo configure.js "--enable-snapshot-build" "--enable-debug-pack" "--with-snapshot-template=d:\php-sdk\snap_5_2\vc6\x86\template" "--with-php-build=d:\php-sdk\snap_5_2\vc6\x86\php_build" "--with-pdo-oci=D:\php-sdk\oracle\instantclient10\sdk,shared" "--with-oci8=D:\php-sdk\oracle\instantclient10\sdk,shared"

In bold you see that it goes to an unknown folder D:\php-sdk\oracle\etc... but I have absolutly nothing in my D:\ drive about this and I don't know where php have this configured, so I don't know where to change this.

Any help..?
Etdashou
 
Posts: 24
Joined: 01. April 2008 20:20

Re: OCIEnvNlsCreate() failed

Postby Etdashou » 26. February 2010 19:33

aaaaaaaaaaaaaaaaaaaAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

"take breath of air"

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHHHHHHHHHHHHH...

I needed to copy the CONTENT of the instant client to apache/bin folder. NOT the folder of instant client...

Now it works.

Thank you soooooo much.
Etdashou
 
Posts: 24
Joined: 01. April 2008 20:20

Re: OCIEnvNlsCreate() failed

Postby thefanatic » 11. October 2010 09:24

philippc
MAN I LOVE YOU !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

I've spent more that 2 days looking for solution for that problem, googling googling, and NOTHING until NOW !!!!!!!!!!!


Everybody just repeat check path check path .....
and as you said:

"
- (lame)Do not bother updating the windoze env PATH (has no effect).
- (lame)Do not both updating the windoze env LD_LIBRARY_PATH either (no effect anyhow).[/i]
- copy the contents only from C:\Temp\instantclient-basic-win32-11.1.0.7.0\instantclient_11_1\* over
to C:\xampp\apache\bin
"

and IT WORKS !!!!!!
Finaly I can connect to my ORACLE with PHP ...
thefanatic
 
Posts: 1
Joined: 11. October 2010 09:20

Re: OCIEnvNlsCreate() failed

Postby ashickurnoor » 17. December 2010 18:32

I am facing same problem, but O/S is ubuntu. What should I do?
ashickurnoor
 
Posts: 5
Joined: 08. December 2010 07:46

Re: OCIEnvNlsCreate() failed

Postby bigbluevan » 07. March 2012 22:58

This will likely resolve the issue without having to copy all your files to Apache...

I resolved the issue for my situation by prepending 'C:\oracle\instantclient_11_2;' to my PATH environment variable.

For example, my PATH in Windows now looks like this (do not copy this and overwrite your path):
C:\oracle\instantclient_11_2;C:\Program Files\unxutils\usr\local\wbin;C:\Program Files\Windows Resource Kits\Tools\;C:\oracle\client\bin;C:\JRun4\verity\k2\_nti40\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\usr\OV\bin;C:\usr\OV\bin\OpC;C:\Program Files\ESTsoft\ALZip\;C:\WINDOWS\system32\WindowsPowerShell\v1.0;C:\WINDOWS\system32\WindowsPowerShell\v1.0

Obviously you'll need to adapt the above for your specific environment. This would probably fix it in a *nix environment too.
bigbluevan
 
Posts: 1
Joined: 07. March 2012 22:54
XAMPP Version: 5.6.3
Operating System: Windows


Return to PHP

Who is online

Users browsing this forum: No registered users and 1 guest