No oci8 module in phpinfo()

心不动则不痛 提交于 2021-01-27 17:44:34

问题


I try to set up connection with oracle database, but I still can't even set up the module. I have rhel 7. 2 server, and I followed whole tutorial for setting up oracle instantclient and configured it with php. One thing I completely don't understand is that oci8 module displays after php -i execution:

oci8

OCI8 Support => enabled
OCI8 DTrace Support => disabled
OCI8 Version => 2.1.3
Revision => $Id: 59f993160cf983dd24bb391b68a65a17303d2dba $
Oracle Run-time Client Library Version => 12.1.0.2.0
Oracle Compile-time Instant Client Version => 12.1

Directive => Local Value => Master Value
oci8.connection_class => no value => no value
oci8.default_prefetch => 100 => 100
oci8.events => Off => Off
oci8.max_persistent => -1 => -1
oci8.old_oci_close_semantics => Off => Off
oci8.persistent_timeout => -1 => -1
oci8.ping_interval => 60 => 60
oci8.privileged_connect => Off => Off
oci8.statement_cache_size => 20 => 20

But there is no such module in phpinfo() inside the script. How to fix it?

PHP Version 7.0.13 Server Apache (httpd)

LD library path:

[![enter image description here][2]][2]


回答1:


The common problem would be that LD_LIBRARY_PATH isn't set for Apache. Try adding it to /etc/sysconfig/httpd like:

LD_LIBRARY_PATH=/full/path/to/oracle-client

If I have my versions right, this version of Apache (i) doesn't like the export keyword for setting variables (ii) requires a full path since it won't expand environment variables. If I'm wrong, try either or both of those.

There is a lot of information about setting the environment in the free Underground Oracle & PHP Manual, see, for example 'Setting Oracle Environment Variables for Apache' on p 108

You say you followed 'whole tutorial'. There are many tutorials. I'd recommend Oracle's installation instructions.




回答2:


The answer is:

setsebool -P allow_execstack 1

You also can enable executable stack for only oci8.so with:

execstack -c /usr/lib64/php/modules/oci8.so

https://serverfault.com/questions/314336/centos-6-php-can-not-load-gdchart-so-and-oci8-so-compiled-by-me




回答3:


make sure that the oci8.so is in the php extension folder

in centos is /usr/lib64/php/modules
in ubuntu xammp is /opt/lampp/lib/php/extensions/no-debug-non-zts-20170718

cd  <extension folder >
sudo chmod 755 oci8.so

It works for me after

 ps ax | grep "fpm"

check the pid of "php-fpm: master process"

sudo kill -9 <pid>

start php-fpm again

sudo service php-fpm start

inspired by https://stackoverflow.com/a/21693610/2538630



来源:https://stackoverflow.com/questions/41043724/no-oci8-module-in-phpinfo

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!