skip to Main Content

I have a redhat server with httpd and oci8 installed properly. I can access correctly oracle functions like oci_connect() when using a script runs through the browser. This is my problem:
I have a shell script shell.sh that has the content:

shell.sh:
/php/bin/path script.php

and in script.php I have the code:

script.php
$conn = oci_connect('user', 'pass', 'MYDB');

I am having the error Uncaught Error: Call to undefined function oci_connect().
I tried to log phpinfo() inside the script.php and I see that oci8 is not loaded! How can I load it?

This is what I tried:

shell.sh

/php/bin/path -c "/path/to/php.ini" script.php

and inside php.ini
I added :

php.ini
extension=oci8.so

When running only script.php throught the browser for exemple everything connect correctly and phpinfo has all extensions activated.

Anyone encountered this issue? Thanks

2

Answers


  1. Chosen as BEST ANSWER

    The issue was the php.ini file and oracle instant client library files did not have the good permissions. Once I added the correct permission, everything worked



  2. What does the following command show you?

    php --ini | grep Loaded
    Loaded Configuration File:         /etc/php/8.2/cli/php.ini
    

    in my case there is an extra php.ini for the CLI

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search