PHP+IIS7配置OCI8連結Oracle 10G的方法_win伺服器

來源:互聯網
上載者:User

1. 下載適用於Oracle10G的 Instant Client Package 32Bit,instantclient-basic-win32-10.2.0.5.zip,(如果你是64Bit系統,下載),解壓。

2.如果不修改系統PATH,那麼解壓出來的9個檔案,全部放到php的bin目錄下,也就是含有php二進位檔案的那個目錄下,如果有潔癖,那就改個PATH。

3.在IIS的FASTCGI下面選擇環境變數編輯 添加如下三個變數

複製代碼 代碼如下:

NLS_LANG=SIMPLIFIED CHINESE_CHINA.ZHS16GBK
ORACLE_HOME=\path\to\php-bin
TNS_ADMIN=\path\to\the-location-of-tnsnames.ora-file

4.在php.ini裡面把php_oci8.dll擴充啟用

5.結束掉老的php-cgi進程重新訪問就可以了

番外:

PHP官方對於Oracle的串連時候的一些變數有說明,這裡的環境變數,除了ORACLE_HOME之類的也不是必須的,官方都有對應的寫法,可以看說明

Common Oracle Environment Variables
NAME PURPOSE
ORACLE_HOME Contains the directory of the full Oracle Database software. Do not set this when using Oracle Instant Client as it is unnecessary and may cause installation problems.
ORACLE_SID Contains the name of the database on the local machine to be connected to. There is no need to set this if you using Oracle Instant Client, or always pass the connection parameter tooci_connect().
LD_LIBRARY_PATH Set this (or its platform equivalent, such as DYLD_LIBRARY_PATH, LIBPATH, or SHLIB_PATH) to the location of the Oracle libraries, for example $ORACLE_HOME/lib or/usr/lib/oracle/11.1/client/lib. This variable is not needed if the libraries are located by a different search mechanism, such as with ldconfig or with LD_PRELOAD.
NLS_LANG This is the primary variable for setting the character set and globalization information used by the Oracle libraries.
ORA_SDTZ Sets the Oracle session timezone.
TNS_ADMIN Contains the directory where the Oracle Net Services configuration files such as tnsnames.ora and sqlnet.ora are kept. Not needed if the oci_connect() connection string uses the Easy Connect naming syntax such as localhost/XE. Not needed if the network configuration files are in one of the default locations such as $ORACLE_HOME/network/admin or /etc.

Less frequently used Oracle environment variables include TWO_TASK, ORA_TZFILE, and the various Oracle globalization settings like NLS* and the ORA_NLS_* variables.

oci_connect的時候,如果使用完整的TNS文法或者簡略的寫法,比如8.8.8.8/abc的時候,TNS_ADMIN也不是必須的。具體的還是看官方文檔吧,不多說了。

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.