简体   繁体   English

致命错误:调用未定义的函数 oci_connect() php 错误

[英]Fatal error: Call to undefined function oci_connect() php error

I'm using yum to install the package.我正在使用 yum 安装软件包。

I ran the command:我运行了命令:

yum list installed *php*

Is says that php-oci8.x86_64 is installed.是说安装了php-oci8.x86_64。

When I go to the web page and it gives me a blank page.当我转到网页时,它给了我一个空白页面。 I turn on php errors and it says我打开 php 错误,它说

Fatal error: Call to undefined function oci_connect()

What am I missing?我错过了什么? Do I have to do something in my php.ini file?我必须在我的 php.ini 文件中做些什么吗?

Any help is greatly appreciated.任何帮助是极大的赞赏。

Edit: Here is the code for the page too.编辑:这也是页面的代码。

protected function oracleSearch($id){

            $live = true;

            if($live === true){
                $db = "(DESCRIPTION=(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = ###.###.###.###)(PORT = 1521)))(CONNECT_DATA = (SID = login)))"; 

                $conn = oci_connect("loginname","password",$db) or die( "Could not connect to Oracle database!");
                if($conn == false){
                    $msg = OCIError($conn) . "<br/>";
                }

                $output = "";

                $stmt = oci_parse($conn,"select * from v_loginnum_prepnum where transaction_id = '".$id."'");
                oci_execute($stmt);
                $ok = oci_fetch_all($stmt,$results);

                $a1 = $results['ACCTNUM'][0];


                $stmt2 = oci_parse($conn,"select * from v_accountdef where acctnum = '$a1'");
                oci_execute($stmt2);
                $ok = oci_fetch_all($stmt2,$results);
                $a2 = $results['ACCTNAME'][0];
                $oracleArray = array ('accountnumber' => $a1, 'companyname' => $a2);

            }else{
                $oracleArray = array ('accountnumber' => '10012', 'companyname' => 'NYS DOC');
            }

            return $oracleArray;
        }

Edit 2:编辑2:

PHP.ini file: PHP.ini 文件:

[OCI8]

; Connection: Enables privileged connections using external
; credentials (OCI_SYSOPER, OCI_SYSDBA)
; http://php.net/oci8.privileged-connect
;oci8.privileged_connect = Off
; Connection: The maximum number of persistent OCI8 connections per
; process. Using -1 means no limit.
; http://php.net/oci8.max-persistent
;oci8.max_persistent = -1

; Connection: The maximum number of seconds a process is allowed to
; maintain an idle persistent connection. Using -1 means idle
; persistent connections will be maintained forever.
; http://php.net/oci8.persistent-timeout
;oci8.persistent_timeout = -1

; Connection: The number of seconds that must pass before issuing a
; ping during oci_pconnect() to check the connection validity. When
; set to 0, each oci_pconnect() will cause a ping. Using -1 disables
; pings completely.
; http://php.net/oci8.ping-interval
;oci8.ping_interval = 60

; Connection: Set this to a user chosen connection class to be used
; for all pooled server requests with Oracle 11g Database Resident
; Connection Pooling (DRCP).  To use DRCP, this value should be set to
; the same string for all web servers running the same application,
; the database pool must be configured, and the connection string must
; specify to use a pooled server.
;oci8.connection_class =

; High Availability: Using On lets PHP receive Fast Application
; Notification (FAN) events generated when a database node fails. The
; database must also be configured to post FAN events.
;oci8.events = Off

; Tuning: This option enables statement caching, and specifies how
; many statements to cache. Using 0 disables statement caching.
; http://php.net/oci8.statement-cache-size
;oci8.statement_cache_size = 20

; Tuning: Enables statement prefetching and sets the default number of
; rows that will be fetched automatically after statement execution.
; http://php.net/oci8.default-prefetch
;oci8.default_prefetch = 100

; Compatibility. Using On means oci_close() will not close
; oci_connect() and oci_new_connect() connections.
; http://php.net/oci8.old-oci-close-semantics
;oci8.old_oci_close_semantics = Off

1) Do a search in php.ini file and locate: 1) 在php.ini文件中搜索并找到:

;extension=php_oci8.dll

2) Remove the ; 2) 删除; making it look like this:使它看起来像这样:

extension=php_oci8.dll

3) Save and restart 3)保存并重启

From the official documentation :官方文档

To enable the OCI8 extension, configure PHP with the option --with-oci8 .要启用 OCI8 扩展,请使用选项--with-oci8配置 PHP。

暂无
暂无

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

相关问题 PHP8 + Oracle OCI8 =&gt; 致命错误:未捕获错误:调用未定义的函数 oci_connect() - PHP8 + Oracle OCI8 => Fatal error: Uncaught Error: Call to undefined function oci_connect() 致命错误:调用Wamp中未定义的函数oci_connect() - Fatal error: Call to undefined function oci_connect() in Wamp 致命错误:调用未定义函数oci_connect() - Fatal error: Call to undefined function oci_connect() PHP中的Oracle连接错误。 致命错误:调用未定义函数oci_connect() - Oracle Connection Error in PHP. Fatal error: Call to undefined function oci_connect() 无法加载oci8 - &gt;致命错误:调用未定义的函数oci_connect() - can not load oci8 -> Fatal error: Call to undefined function oci_connect() 致命错误:在第3行的C:\\ xampp \\ htdocs \\ Project1 \\ connect.php中调用未定义函数oci_connect() - Fatal error: Call to undefined function oci_connect() in C:\xampp\htdocs\Project1\connect.php on line 3 致命错误:未捕获错误:通过命令提示符运行php脚本时调用未定义函数oci_connect() - Fatal error: Uncaught Error: Call to undefined function oci_connect() while running the php script through command prompt 致命错误:在第71行的C:\\ xampp81 \\ htdocs \\ aaainc \\ db.php中调用未定义函数oci_connect() - Fatal error: Call to undefined function oci_connect() in C:\xampp81\htdocs\aaainc\db.php on line 71 致命错误:在第75行的C:\\ xampp81 \\ htdocs \\ test \\ inc \\ db.php中调用未定义函数oci_connect() - Fatal error: Call to undefined function oci_connect() in C:\xampp81\htdocs\test\inc\db.php on line 75 WAMP服务器由于致命错误而停止工作:调用未定义函数oci_connect() - WAMP server stopped working due to Fatal error: Call to undefined function oci_connect()
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM