使用 REMI 存储库在 rhel 6 上设置 oci8
我以前曾经这样做过,但这是一个漫长的试验和错误过程,导致我的测试机器具有 php、oci8 和即时客户端的多个副本,而且我仍然不确定我做了什么它起作用了。
到目前为止,我已经设置了 yum 来使用 remi 存储库,完成了 yum install php php-oci8 php-pdo,并下载了 oracle 即时客户端并完成了>rpm -Uh oracle-instantclient11.2-basic-11.2.0.2.0.x86_64\ \(1\).rpm
当我这样做时尽管在页面上使用 phpinfo()
,但它仍然没有将 oci8 列为模块之一。
我认为错误出在 ORACLE_HOME
环境变量上,但我不确定它应该设置为什么。现在我有:
SetEnv LD_LIBRARY_PATH /usr/lib/oracle/11.2/client64/lib
SetEnv ORACLE_HOME /usr/lib/oracle/11.2
在 /etc/httpd/conf/httpd.conf
上次我得到这个工作时,我想我只是继续卸载 php 和 php-oci8 并重新安装,直到一切正常。
我的工作服务器的 ORACLE_HOME 设置如下:
但是新的非工作服务器在这里设置了 ORACLE_HOME:
如何设置环境中的 ORACLE_HOME< phpinfo() 的 /code> 部分?
I've done this before, but it was a long trial and error process that resulted with my test machine having multiple copies of php, oci8, and the instant client, and I'm still not sure what it was that I did that made it work.
So far, i've set up yum
to use the remi repository, done yum install php php-oci8 php-pdo
, and downloaded the oracle instant client and done rpm -Uh oracle-instantclient11.2-basic-11.2.0.2.0.x86_64\ \(1\).rpm
When I do phpinfo()
on a page though, it still doesn't list oci8 as one of the modules.
I think the error is with the ORACLE_HOME
environment variable, but I'm not sure what it's supposed to be set to. right now i have:
SetEnv LD_LIBRARY_PATH /usr/lib/oracle/11.2/client64/lib
SetEnv ORACLE_HOME /usr/lib/oracle/11.2
in /etc/httpd/conf/httpd.conf
The last time I got this working I think I just kept on uninstalling php and php-oci8 and re-installing until things worked.
My working server has ORACLE_HOME set like this:
But the new non working one has ORACLE_HOME set here:
how do i set the ORACLE_HOME that is in the Enviroment
section of phpinfo()?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
经过一番尝试和错误,我找到了问题的答案。我使用
PECL
安装 oci8,而不是使用yum
和 REMI 存储库,但我认为这也应该适用于使用 yum 安装它。解决方案:关闭selinux(将其置于宽容模式)。这实际上是oracle建议的解决方案。您必须在安装之前将其关闭才能使其正常安装,并保持关闭状态才能使其正常工作。
After some trial and error, I found the answer to the issue. I installed oci8 with
PECL
instead of usingyum
and the REMI repository, but I think this should work for installing it with yum too.Solution: turn selinux off (put it in permissive mode). This is actually oracle's suggested solution. You have to turn it off before installation to get it to install properly, and keep it off to get it to work properly.
我不确定为什么 Apache 环境中显示的内容与 httpd.conf 文件中显示的内容不同,除非您更改了某些内容,但您可以使用 putenv 因此,代码顶部的类似
putenv("ORACLE_HOME=" . $_SERVER['ORACLE_HOME']);
的内容可能会 工作。或者如果需要的话对值进行硬编码。I'm not sure why what's showing up in your Apache Environment is different from what's in your httpd.conf file unless you changed something, but you can set an environment variable with putenv so something like
putenv("ORACLE_HOME=" . $_SERVER['ORACLE_HOME']);
at the top of your code may work. Or hard-code the value if need be.