简体   繁体   English

OS X El Capitan中的XAMPP-oci_connect():OCIEnvNlsCreate()失败

[英]XAMPP in OS X El Capitan - oci_connect(): OCIEnvNlsCreate() failed

This issue started just after I upgraded my Mac to OS X El Capitan. 在我将Mac升级到OS X El Capitan之后,这个问题就开始了。 Before that it was working just fine. 在此之前,它工作得很好。

I am using XAMPP and Oracle Instant Client was properly set up to connect with Oracle DB. 我正在使用XAMPP,并且已正确设置Oracle Instant Client以与Oracle DB连接。 I followed the instructions mentioned here while installing (click on the question "How do I activate the OCI8/Oracle extension for PHP?"). 安装时,我遵循了此处提到的说明(单击问题“如何激活PHP的OCI8 / Oracle扩展?”)。

But, after I upgraded my OS to OS X El Capitan, it started to show this warning, 但是,在我将操作系统升级到OS X El Capitan之后,它开始显示此警告,

Warning: oci_connect(): OCIEnvNlsCreate() failed. 警告:oci_connect():OCIEnvNlsCreate()失败。 There is something wrong with your system - please check that DYLD_LIBRARY_PATH includes the directory with Oracle Instant Client libraries 您的系统有问题-请检查DYLD_LIBRARY_PATH是否包含Oracle Instant Client库的目录

I am searching for solution all over the internet (not only SO), for the last few days and the nearest match I found was this : https://stackoverflow.com/a/20670810/5645769 . 在过去的几天里,我一直在整个Internet(不仅是SO)上寻找解决方案,而我发现的最接近的匹配项是: https : //stackoverflow.com/a/20670810/5645769 So, I tried to edit the file org.apache.httpd.plist , as suggessted by the answer. 因此,我尝试按照答案的建议编辑文件org.apache.httpd.plist But I was having this error : 但是我有这个错误:

You don't own the file "org.apache.httpd.plist" and don't have permission to write to it. 您没有文件“ org.apache.httpd.plist”,也没有写权限。 You can duplicate this document and edit the duplicate. 您可以复制此文档并编辑副本。 Only the duplicate will include your changes. 仅重复项将包含您的更改。

I asked about that to OP and his reply didn't make any help to resolve the issue. 我向OP询问了有关问题,他的答复对解决该问题没有任何帮助。 So my search for solutions continued. 因此,我继续寻找解决方案。 After a few more days of search, I found this post https://stackoverflow.com/a/32910408/5645769 . 经过几天的搜索,我发现了这篇文章https://stackoverflow.com/a/32910408/5645769 So I followed the instructions to disable SIP (System Intregrity Protection) and I was then able to add write access to the file and containing folder for my account (and also administrator). 因此,我按照说明禁用了SIP(系统完整性保护),然后我就可以为该文件(包括管理员)添加对该文件和包含文件夹的写访问权限。 After that oci_connect() started working again. 之后, oci_connect()重新开始工作。

But when I disabled the SIP again following the same answer, the same error comes again. 但是,当我按照相同的答案再次禁用SIP时,再次出现相同的错误。 I am not sure, but it seems like there is something happening with other file permissions which oci_connect() is trying to use but it can access only when SIP is disabled. 我不确定,但是oci_connect()尝试使用的其他文件权限似乎正在发生问题,但只有在禁用SIP时才能访问。

Currently I am working with keeping the SIP disabled (not sure, what harm it may cause), I need a solution which will work while keeping the SIP enabled. 目前,我正在使SIP保持禁用状态(不确定,这可能造成什么危害),我需要一种在保持SIP处于启用状态的情况下仍可工作的解决方案。

I am spending many days with this. 我为此花了很多天。 Any help will be highly appreciated. 任何帮助将不胜感激。

/System/Library/LaunchDaemons/org.apache.httpd.plist is only for controlling the behaviour of the Apache server built in to OS X. /System/Library/LaunchDaemons/org.apache.httpd.plist仅用于控制内置于OS X的Apache服务器的行为。

To set DYLD_LIBRARY_PATH for the XAMPP version of Apache you'll need to edit its startup script: 要为XAMPP版本的Apache设置DYLD_LIBRARY_PATH ,您需要编辑其启动脚本:

sudo nano /Applications/XAMPP/xamppfiles/apache2/ctl.sh

On the second line of the file, after #!/bin/sh you can add whatever you need to: 在文件的第二行,在#!/bin/sh您可以添加所需的内容:

#!/bin/sh

DYLD_LIBRARY_PATH=/path/to/your/library/files

ERROR=0
HTTPD_STATUS=""
HTTPD_PIDFILE=/Applications/XAMPP/xamppfiles/logs/httpd.pid
HTTPD="/Applications/XAMPP/xamppfiles/bin/httpd -f /Applications/XAMPP/xamppfiles/etc/httpd.conf"

DO NOT disable system integrity protection. 不要禁用系统完整性保护。 It's there for a reason. 在那里是有原因的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM