PHP Warning: oci_connect(): OCIEnvNlsCreate() failed only on command line

Keywords: General - AWS - Technical issue - Other
bnsupport ID: 7403ec60-79af-f6d8-67ff-6c874c2ba43f
Description:
Hi.
I’m having a problem using the oci8 module.

Access through the browser, I can connect to the Oracle database successfully.

However, when I try by command line it returns the error: PHP Warning: oci_connect (): OCIEnvNlsCreate () failed.

I installed the oci8 module using this documentation: https://docs.bitnami.com/aws/infrastructure/lamp/configuration/install-modules-php/

PHP variables: $ _SERVER [‘LD_LIBRARY_PATH’] / home / bitnami / instantclient_19_6

Would anyone have any ideas?

Hello @tkuroski,

I have installed the oci8 module following our guide and I have found a couple of points that can be a bit confusing. Could you check that the output of the following commands is the same as mine:

$ ls /home/bitnami/instantclient_19_6
adrci          genezi                 libclntsh.so.10.1  libclntsh.so.18.1  libmql1.so   libocci.so.10.1  libocci.so.18.1  libocijdbc19.so   ojdbc8.jar   SDK_README  xstreams.jar
BASIC_LICENSE  libclntshcore.so.19.1  libclntsh.so.11.1  libclntsh.so.19.1  libnnz19.so  libocci.so.11.1  libocci.so.19.1  liboramysql19.so  sdk          ucp.jar
BASIC_README   libclntsh.so           libclntsh.so.12.1  libipc1.so         libocci.so   libocci.so.12.1  libociei.so      network           SDK_LICENSE  uidrvci

$ echo $LD_LIBRARY_PATH
/home/bitnami/instantclient_19_6

Keep in mind that you need to have the files from both instantclient-basic-linux.x64-19.6.0.0.0dbru.zip and instantclient-sdk-linux.x64-19.6.0.0.0dbru.zip in /home/bitnami/instantclient_19_6. The commands from the guide will work regardless of you having the sdk related files in said folder. To check the install is proceeding as expected, check for this lines in the output of the following command:

./configure --with-oci8=instantclient,/home/bitnami/instantclient_19_6
...
checking Oracle Instant Client directory... /home/bitnami/instantclient_19_6
checking Oracle Instant Client SDK header directory... /home/bitnami/instantclient_19_6/sdk/include
...

Regards,
Francisco de Paz

bitnami@ip-172-26-10-84:~$ ls /home/bitnami/instantclient_19_6
adrci                  libclntsh.so       libclntsh.so.19.1  libocci.so.10.1  libociei.so       sdk          xstreams.jar
BASIC_LICENSE          libclntsh.so.10.1  libipc1.so         libocci.so.11.1  libocijdbc19.so   SDK_LICENSE
BASIC_README           libclntsh.so.11.1  libmql1.so         libocci.so.12.1  liboramysql19.so  SDK_README
genezi                 libclntsh.so.12.1  libnnz19.so        libocci.so.18.1  network           ucp.jar
libclntshcore.so.19.1  libclntsh.so.18.1  libocci.so         libocci.so.19.1  ojdbc8.jar        uidrvci
bitnami@ip-172-26-10-84:~$ echo $LD_LIBRARY_PATH

bitnami@ip-172-26-10-84:~$ 

LD_LIBRARY_PATH apparently not defined, but in PHP variables this is set $ _SERVER [‘LD_LIBRARY_PATH’] / home / bitnami / instantclient_19_6

In /opt/bitnami/scripts/php-env.sh I inserted the line export LD_LIBRARY_PATH=/home/bitnami/instantclient_19_6${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}

It would have another place to declare LD_LIBRARY_PATH ?

Hello @tkuroski,

The scripts at /opt/bitnami/scripts are using when you first initialize the instance and thus your env won’t be loaded. Could you try exporting the variable running in the console the command included in the guide:

export LD_LIBRARY_PATH=/home/bitnami/instantclient_19_6${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}

Regards,
Francisco de Paz

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.