Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

oci_connect - OCIEnvNlsCreate() failed, oci8

817593Nov 22 2010 — edited Nov 24 2010
I am hoping to get some assistance getting a connection set up to an Oracle DB from PHP. I started by following the guide given on the Oracle site to "Enabling the PHP OCI8 Extension on Windows" http://www.oracle.com/technetwork/articles/technote-php-instant-084410.html

I am stuck with the following error.

Warning: oci_connect() [function.oci-connect]: OCIEnvNlsCreate() failed. There is something wrong with your system - please check that PATH includes the directory with Oracle Instant Client libraries in C:\Projects\Dashboardphp\application\views\scripts\index\index.phtml on line 9

I have completed the following steps:

- I downloaded the instant client and unzipped it to the following directory: C:\instantclient_11_2
- I uncommented the extension=php_oci8.dll in the php.ini file
- I set the PATH environment variable to the following value. (I have restarted by PC several times to make sure)

C:\instantclient_11_2;C:\Program Files\Java\jdk1.6.0_21\bin;C:\Program Files\Voltage Security\Voltage SecureFile\;C:\ORACLE\ORA92\bin;C:\Program Files\Oracle\jre\1.1.8\bin;C:\ColdFusion8\verity\k2\_nti40\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Microsoft SQL Server\80\Tools\Binn\;C:\Program Files\Microsoft SQL Server\90\Tools\binn\;C:\Program Files\Microsoft SQL Server\90\DTS\Binn\;C:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\;C:\Program Files\Windows Imaging\;C:\Program Files\Voltage Security\Voltage SecureMail\;C:\Program Files\Common Files\Voltage Security\;C:\Program Files\Enterprise Vault\EVClient\;C:\Program Files\Encentuate\AccessAgent\Integration\Carefx\Fusionfx;C:\Program Files\Encentuate;

Here is some of my setup information. Please let me know if you need anything additional.

Windows NT MOCDTL06PC4743 5.1 build 2600 (Windows XP Professional Service Pack 3) i586
PHP Version 5.3.3
I am using Zend Server CE which came packaged with Apache 2.2
Oracle DB Version 11.1.0.7.0

Note: I also have previous Oracle client installed under C:\Oracle\ora92. I have read several comments that have suggested that an additional client may cause conflicts. I wanted to see if there is any validity to this claim before I remove it.

Here is the PHP code:

<?php

/*phpinfo();*/

date_default_timezone_set('America/Chicago');

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

$db_conn = oci_connect('xxxxxxxxx', 'xxxxxxxx', $db_test);
$cmdstr = "select 'It Works' as \"Message\" from dual";
$parsed = ociparse($db_conn, $cmdstr);
ociexecute($parsed);
$nrows = ocifetchstatement($parsed, $results);
for ($i = 0; $i < $nrows; $i++ ) {
echo $results["Message"][$i] ;
}

Any help appreciated,
Ryan
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 22 2010
Added on Nov 22 2010
4 comments
3,737 views