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

Keywords: General - AWS - Technical issue - Other
bnsupport ID: 7403ec60-79af-f6d8-67ff-6c874c2ba43f
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:

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          ojdbc8.jar   SDK_README  xstreams.jar
BASIC_LICENSE  sdk          ucp.jar
BASIC_README       network           SDK_LICENSE  uidrvci


Keep in mind that you need to have the files from both and 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

Francisco de Paz

bitnami@ip-172-26-10-84:~$ ls /home/bitnami/instantclient_19_6
adrci               sdk          xstreams.jar
genezi         network           ucp.jar  ojdbc8.jar        uidrvci
bitnami@ip-172-26-10-84:~$ echo $LD_LIBRARY_PATH


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/ 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}

Francisco de Paz

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