OCIEnvNlsCreate() failed. When i try to connect my

2019-02-26 21:46发布

问题:

phpinfo

_ENV["ORACLE_HOME"] C:\oracle\instantclient_11_2\
_ENV["OS"]  Windows_NT
_ENV["Path"]    C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\oracle\instantclient_11_2;\;

oci8

OCI8 Support    enabled
Version     1.2.5
Revision    $Revision: 1.269.2.16.2.43 $
Active Persistent Connections   0
Active Connections  0
Temporary Lob support   enabled
Collections support     enabled 

php code

<?php
     $conn = OCILogon('mppd1','mppd1', "121.256.476.86:1521/mydatabase");

$query = 'select * from users';

$stid = OCIParse($conn, $query);
//OCIExecute($stid, OCI_DEFAULT);
while ($succ = OCIFetchInto($stid, $row)) {
foreach ($row as $item) {
echo $item." ";
}
echo "<br>\n";
}

OCILogoff($conn);
?>

i am getting this error

Severity: Warning

Message: ocilogon() [function.ocilogon]: OCIEnvNlsCreate() failed. There is something wrong with your system - please check that PATH includes the directory with Oracle Instant Client libraries

回答1:

I solved it copying all the content of C:\instantclient_11_2 (please check what´s yours) inside system and system32 folders in Windows , then I delete the path of C:\instantclient_11_2 in the PATH enviroment variable.

I am using XAMPP and Windows 8 and it´s the first time I see this issue. I always configured properly oci 8 with xampp and windows in a few minutes. I hope this would help you.



回答2:

https://forums.oracle.com/forums/message.jspa?messageID=1742926#1745145

There are several potential solutions on that page ranging from re-installing xampp to checking permissions to using native php oci_connect(). Have you tried any of these things?



回答3:

Probably you should download InstantClient and replace contents of /instantclient folder of Oracle client with the .dll-s of InstantClient.



回答4:

You need to copy all content of the instant client to apache/bin

im using xampp and working for me.

copy all files of the instant client enter image description here to apache/bin