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!

OCIEnvNlsCreate() failed. There is something wrong with your system - please check that LD_LIBRARY_P

daniel4996Sep 15 2017 — edited Sep 20 2017

Hi,

I've been having troubles with OCI8.

My environment description is the following:

Red Hat Enterprise Linux Server release 7.4 (Maipo) (x86_64)

PHP 5.4.16

Apache/2.4.6 (Red Hat Enterprise Linux)

Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit

I installed from: Instant Client downloads for Linux x86-64

- oracle-instantclient12.2-basic-12.2.0.1.0-1.x86_64.rpm

- oracle-instantclient12.2-devel-12.2.0.1.0-1.x86_64.rpm

- oracle-instantclient12.2-odbc-12.2.0.1.0-1.x86_64.rpm

Also, I install OCI8 1.4.10, following the next steps:

cd /installation

tar -zxf oci8-1.4.10.tgz

cd oci8-1.4.10

phpize

./configure -with-oci8=shared,instantclient,/usr/lib/oracle/12.2/client64/lib

make install

I edited php.ini with:

extension = oci8.so

...

..

..

extension_dir=/usr/lib64/php/modules

I made a phpinfo page:

pastedImage_2.png

Environment variable are defined in:

/root/.bash_profile :

# Get the aliases and functions

if [ -f ~/.bashrc ]; then

    **. ~/.bashrc**

fi

# User specific environment and startup programs

export ORACLE_HOME=/usr/lib/oracle/12.2/client64

export LD_LIBRARY_PATH=/usr/lib/oracle/12.2/client64/lib

export NLS_LANG=American_America.UTF8

export TNS_ADMIN=$ORACLE_HOME/network/admin

PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin

export PATH

and in /etc/sysconfig/httpd

LANG=C

LD_LIBRARY_PATH=/usr/lib/oracle/12.2/client64/lib

Whe I try to run this test code in php:

<?php

$Conection = oci_connect('user','pass','IP/name');

if(!$Conection){

$e=oci_error();

echo"Error:".$e["message"];

die();

}

$sqlc="select * from customers";

**$Show=oci\_parse($Conection, $sqlc);**

    **if (!$Show){**

    **$e=oci\_error($Conection);**

    **echo "Request error".$e\["message"\];**

    **die();**

**}**  

**$r=oci\_execute($Show);**

while($row=oci_fetch_array($Show,OCI_ASSOC)){

    **$n= $row\['CUSTOMER\_NAME'\];**

    **$c= $row\['CITY'\];**

    **echo $n;**

    **echo "\<br>";**

    **echo $c;**

}

?>

and use this:

cd /var/log/httpd

tail -F error_logs

I got this:

[Fri Sep 15 11:42:39.804547 2017] [:error] [pid 1278] [client 172.24.143.153:50931] PHP Warning: oci_connect(): OCIEnvNlsCreate() failed. There is something wrong with your system - please check that LD_LIBRARY_PATH includes the directory with Oracle Instant Client libraries in /var/www/html/prueba_oracle.php on line 5

[Fri Sep 15 11:42:39.804679 2017] [:error] [pid 1278] [client 172.24.143.153:50931] PHP Warning: oci_connect(): Error while trying to retrieve text for error ORA-01804\n in /var/www/html/prueba_oracle.php on line 5

I thought that the LD_LIBRARY_PATH was not set, but when I did "echo $LD_LIBRARY_PATH", I got /usr/lib/oracle/12.2/client64/lib

phpinfo shows me:

pastedImage_10.png

pastedImage_11.png

pastedImage_13.png

pastedImage_14.png

The second error, I read that it was an error with time zone but I don't know how to set the correct value

Maybe the problem is the NLS_LANG.

Thanks for reading

Any help would be appreciated.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 18 2017
Added on Sep 15 2017
3 comments
24,853 views