Skip to content

oci_connect(): Not working for thread-safe - OCIEnvNlsCreate() failed. There is something wrong with your system - environment variable issue #37

@laurinkeithdavis

Description

@laurinkeithdavis

Sorry for the bad title.

We are using PHP on Windows and have been using this extension for years with PHP non-thread-safe (NTS). We are now having to switch to thread-safe (TS) PHP so that we can use the actively developed Snowflake PDO extension, which will only compile on Windows as thread-safe. Using the OCI8 extension with TS, we get this error:

oci_connect(): OCIEnvNlsCreate() failed. There is something wrong with your system - please check that PATH includes the directory with Oracle Instant Client libraries

The only way to make this work for TS is to copy the Instant Client files (just the relevant DLLs) into the PHP folder.

After extensive testing, it appears that the driver (not the extension) does not "see" the environment variables we have set (PATH or TNS_ADMIN).
I have even compiled the extension myself using SDK from the same version of the Oracle Instant Client, but it still fails with the same error. Again, using the NTS version of PHP with this extension works perfectly.

When I compiled it myself, I verified that it was failing in oci8.c on line 198 by changing the error messages. I also added code to print the PATH env var to the console so that I could verify it is getting the env var value and it is, but apparently the Oracle client/driver is not.

Any idea how to make this work without having to store the Instant Client in our PHP folder?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions