简体   繁体   English

oci_connect() 在终端/centos 服务器上工作,但不在浏览器上

[英]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警告:oci_connect(): ORA-28759: 在第 16 行的 /var/www/myapp/abc.php 中打开文件失败

Fatal error: ORA-28759: failure to open file in /var/www/myapp/abc.php on line 19致命错误:ORA-28759:无法在第 19 行的 /var/www/myapp/abc.php 中打开文件

But when running same file from Server terminal as a root user > PHP abc.php that time oracle database output is coming. 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.我正在使用 PHP7、Apache 并安装了 Oracle 19c 家庭数据库。

I am using oci_connect to communication with oracle database from PHP code.我正在使用oci_connect与 PHP 代码中的 oracle 数据库进行通信。


I think there is some permission issue to my httpd (apahce).我认为我的 httpd (apahce) 存在一些权限问题。

Please give suggestion.请给建议。

  • Check that the web server process has access to all the Oracle client libraries and data files.检查 web 服务器进程是否有权访问所有 Oracle 客户端库和数据文件。 Since you are using an Oracle home, make sure all the directories have 'other' access permissions set.由于您使用的是 Oracle 主目录,因此请确保所有目录都设置了“其他”访问权限。 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.确保 web 服务器进程环境变量与命令 shell 使用的相同,以确保使用相同的 Oracle 客户端库集。 (Do you also have Instant Client installed somewhere, or another Oracle home??). (您是否还在某处安装了 Instant Client,或另一个 Oracle 主页??)。

  • 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. “ORA-28759:无法打开文件”的最近常见原因是使用 Oracle 云钱包并且钱包的 sqlnet.ora 路径( DIRECTORY=...位)无效。 Check the path is OK, or the Oracle Net configuration files are in the default location (and are readable).检查路径是否正常,或者 Oracle 网络配置文件位于默认位置(并且可读)。 Note that with Instant Client 19.14 you can use 1-way TLS so wallets are not always needed, depending on your net configuration.请注意,使用 Instant Client 19.14,您可以使用单向 TLS,因此并不总是需要钱包,具体取决于您的网络配置。

  • I doubt there is a problem with php.ini, since you are obviously able to call OCI8 functions.我怀疑 php.ini 是否存在问题,因为您显然可以调用 OCI8 函数。 The php.ini file doesn't control behaviors of the Oracle Client libraries that are throwing the error. php.ini 文件不控制引发错误的 Oracle 客户端库的行为。

Update your question with more details about how you are setting the environment and what Oracle configuration files are being used for connecting更新您的问题,详细了解您如何设置环境以及正在使用哪些 Oracle 配置文件进行连接

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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