MacOS – System Integrity Protection (SIP) creating problem for oci_connect(): OCIEnvNlsCreate()

macosoraclePHPsip

After I upgraded my OS to El Capitan (which comes with SIP), I am getting error in oci_connect()

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

If I disable the SIP, everything works fine again. But I understand keeping SIP disabled is not good for security. So I was looking for a solution to keep the SIP enabled and make oci_connect() work like before.

I am using XAMPP server for PHP and have oci8 for oci_connect.

I had a post on SO for this, where couldn't find any help yet : https://stackoverflow.com/questions/35356318/xampp-in-os-x-el-capitan-oci-connect-ocienvnlscreate-failed

Best Answer

Oracle ships instant client libs with wrong search paths. You can manually fix them by using:

https://github.com/kubo/fix_oralib_osx

AFAIK SIP influences how library search path is working. DYLD_LIBRARY_PATH might be ignored when SIP is used.