天天看點

php沒有oci8,PHP 無法開啟 OCI8 擴充原因

今天剛好有個需求,要用 PHP 把資料寫入遠端?Oracle 資料庫,是以要用到?OCI8 擴充。但總是無法開啟,查閱了大量資料才知道原來是因為本地機器沒安裝?Oracle 資料庫,?系統缺少Oracle的幾個關鍵DLL造成的,可以通過安裝Oracle Instant Client 來添加這些DLL。

?

Oracle Instant Client下載下傳位址如下:

http://www.oracle.com/technetwork/cn/database/features/instant-client/index-092537-zhs.html

?

下載下傳後,将其解壓到 D:\Program Files\instantclient_11_2 (非固定位置),并将該路徑加入到系統PATH環境變量的最前面。

然後重新開機一下Webserver,再檢視phpinfo,可以OCI8子產品資訊了。

?

總結一下,PHP OCI8擴充的開啟步驟:

(1)去掉php.ini中extension=php_oci8.dll前面的注釋。

php沒有oci8,PHP 無法開啟 OCI8 擴充原因

?

(2)解壓 Oracle Instant Client,并将解壓目錄加入到系統PATH環境變量中。

?

php沒有oci8,PHP 無法開啟 OCI8 擴充原因

?

(3)重新開機Webserver,使用phpinfo檢視OCI8子產品是否出現。

?

php沒有oci8,PHP 無法開啟 OCI8 擴充原因

?

下面是Oracle官方的安裝說明,很詳細:

《nstalling PHP and the Oracle Instant Client for Linux and Windows

http://www.oracle.com/technetwork/articles/technote-php-instant-084410.html

?

另外關于PHP操作Oracle的資料,這個感覺不錯:

http://www.oracle.com/technetwork/cn/articles/dsl/technote-php-instant-090922-zhs.html

?

OCI8操作Oracle的PHP手冊:

http://php.net/manual/en/book.oci8.php

原文連結:http://woqilin.blogspot.com/2016/04/php-oci8.html

個人首頁:https://plus.google.com/+sherlockwang/posts

php沒有oci8,PHP 無法開啟 OCI8 擴充原因

class='magplus' title='點選檢視原始大小圖檔' />

大小: 179.2 KB

php沒有oci8,PHP 無法開啟 OCI8 擴充原因

大小: 229 KB

php沒有oci8,PHP 無法開啟 OCI8 擴充原因

大小: 212.9 KB

檢視圖檔附件