dude
dude

Reputation: 4972

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

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

Upvotes: 2

Views: 20325

Answers (5)

Muhammad Habib
Muhammad Habib

Reputation: 400

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

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

and it worked.

My setup:

  • System: Windows 7
  • Instantclient: instantclient-basiclite-win32-11.1.0.7.0
  • Web Server: Uwamp3

Upvotes: 1

Glauber Monteiro
Glauber Monteiro

Reputation: 21

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

Upvotes: 1

Edu Labs Colombia
Edu Labs Colombia

Reputation: 61

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.

Upvotes: 6

Hyyudu
Hyyudu

Reputation: 1

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

Upvotes: 0

stormdrain
stormdrain

Reputation: 7895

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?

Upvotes: 0

Related Questions