OCIEnvNlsCreate() 失败。当我尝试在 php 中连接我的 oracle 数据库时

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9734100/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 00:40:03  来源:igfitidea点击:

OCIEnvNlsCreate() failed. When i try to connect my oracle database in php

phporaclecodeigniter

提问by dude

phpinfo

php信息

_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

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

回答by Edu Labs Colombia

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.

我解决了将 C:\instantclient_11_2 的所有内容(请检查您的)复制到 Windows 的 system 和 system32 文件夹中,然后在 PATH 环境变量中删除 C:\instantclient_11_2 的路径。

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.

我正在使用 XAMPP 和 Windows 8,这是我第一次看到这个问题。我总是在几分钟内使用 xampp 和 windows 正确配置 oci 8。我希望这会帮助你。

回答by Glauber Monteiro

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

您需要将即时客户端的所有内容复制到 apache/bin

im using xampp and working for me.

我正在使用 xampp 并对我来说有效。

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

将即时客户端的所有文件在这里输入图像描述复制到 apache/bin

回答by Muhammad Habib

I was facing the same error on uwamp 3 in connecting to oracle 11gR2.

我在 uwamp 3 上连接到 oracle 11gR2 时遇到了同样的错误。

I deleted the oracle instantclient from path variable and copied all files from instantclient to uwamp\bin\apache\bin

我从路径变量中删除了 oracle Instantclient 并将所有文件从 Instantclient 复制到 uwamp\bin\apache\bin

and it worked.

它奏效了。

My setup:

我的设置:

  • System: Windows 7
  • Instantclient: instantclient-basiclite-win32-11.1.0.7.0
  • Web Server: Uwamp3
  • 系统:Windows 7
  • Instantclient:instantclient-basiclite-win32-11.1.0.7.0
  • 网络服务器:Uwamp3

回答by stormdrain

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

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?

该页面上有几个潜在的解决方案,从重新安装 xampp 到检查权限,再到使用本机 php oci_connect()。你有没有尝试过这些东西?

回答by Hyyudu

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

可能您应该下载 InstantClient 并将 Oracle 客户端的 /instantclient 文件夹的内容替换为 InstantClient 的 .dll-s。