3

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

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

OverSteppe
  • 146
  • 1
  • 2
  • 15
  • 1
    There are separate configurations for CLI and your web environment ... It's quite possible that you've only enabled the module under CLI. – Narf Dec 08 '16 at 16:24
  • @Narf I included driver extention into ini file, what else have to be done? – OverSteppe Dec 08 '16 at 16:53
  • Find the correct php.ini for your httpd (that's probably shown by `phpinfo()`) and add it there. – Narf Dec 08 '16 at 16:56
  • @Narf they are absolutely the same, to check it I included external ini file with oci8 extention line, and this config was loaded in phpinfo(). But module still does not appear as a section – OverSteppe Dec 08 '16 at 18:26
  • Well, do you have the `oci8_*()` functions available? If so, I wouldn't care if something appears in `phpinfo()` ... maybe I got the question wrong. Either way, I'm out of ideas. – Narf Dec 08 '16 at 19:24

3 Answers3

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.

Christopher Jones
  • 9,449
  • 3
  • 24
  • 48
0

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

Community
  • 1
  • 1
OverSteppe
  • 146
  • 1
  • 2
  • 15
0

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

Yasser
  • 1,159
  • 1
  • 14
  • 19