2014-01-15 172 views
0

我正在使用yum來安裝軟件包。致命錯誤:調用未定義的函數oci_connect()php error

我跑的命令:

yum list installed *php* 

是說,PHP-oci8.x86_64安裝。

當我去到網頁,它給了我一個空白頁。我打開php錯誤,它說

Fatal error: Call to undefined function oci_connect() 

我錯過了什麼?我必須在我的php.ini文件中做些什麼嗎?

任何幫助,非常感謝。

編輯:這裏也是頁面的代碼。

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; 
     } 

編輯2:

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 
+0

轉到您的php.ini文件並取消註釋php_oci * lib。 –

+0

我編輯了這個問題,以包含我的php.ini文件中與oci8相關的內容。我應該取消註釋什麼?我沒有看到你談論的lib。 –

+0

這是oci lib的特定配置。你必須取消oci lib的註釋:在你的php.ini上查找這個:Dynamic Extensions –

回答

0

1)執行搜索在php.ini文件,並找到:

;extension=php_oci8.dll 

2)拆下;製作它看起來像這樣:

extension=php_oci8.dll 

3)保存並重新啓動

相關問題