简体   繁体   中英

oci_connect() is working on terminal/centos server but not on browser

I am getting error when I trying from browser.

Warning: oci_connect(): ORA-28759: failure to open file in /var/www/myapp/abc.php on line 16

Fatal error: ORA-28759: failure to open file in /var/www/myapp/abc.php on line 19

But when running same file from Server terminal as a root user > PHP abc.php that time oracle database output is coming.

I didn't understand why is running from terminal but not on browser.

I am using PHP7, Apache and Installed Oracle 19c home db.

I am using oci_connect to communication with oracle database from PHP code.


I think there is some permission issue to my httpd (apahce).

Please give suggestion.

  • Check that the web server process has access to all the Oracle client libraries and data files. Since you are using an Oracle home, make sure all the directories have 'other' access permissions set. Typically user home directories don't have this by default.

  • Since the app is running, some libraries are being loaded so maybe permissions are OK? Make sure you have the web server process environment variables the same as those used by your command shell to make sure the same set of Oracle client libraries are being used. (Do you also have Instant Client installed somewhere, or another Oracle home??).

  • The recent common causes of 'ORA-28759: failure to open file' are when Oracle cloud wallets are being used and the sqlnet.ora path to the wallet (the DIRECTORY=... bit) is not valid. Check the path is OK, or the Oracle Net configuration files are in the default location (and are readable). Note that with Instant Client 19.14 you can use 1-way TLS so wallets are not always needed, depending on your net configuration.

  • I doubt there is a problem with php.ini, since you are obviously able to call OCI8 functions. The php.ini file doesn't control behaviors of the Oracle Client libraries that are throwing the error.

Update your question with more details about how you are setting the environment and what Oracle configuration files are being used for connecting

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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