PHP+IIS7配置OCI8鏈接Oracle 10G的方法
1. 下載適用于Oracle10G的 Instant Client Package 32Bit,instantclient-basic-win32-10.2.0.5.zip,(如果你是64Bit系統(tǒng),下載),解壓。
2.如果不修改系統(tǒng)PATH,那么解壓出來的9個文件,全部放到php的bin目錄下,也就是含有php二進制文件的那個目錄下,如果有潔癖,那就改個PATH。
3.在IIS的FASTCGI下面選擇環(huán)境變量編輯 添加如下三個變量
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.結(jié)束掉老的php-cgi進程重新訪問就可以了
番外:
PHP官方對于Oracle的連接時候的一些變量有說明,這里的環(huán)境變量,除了ORACLE_HOME之類的也不是必須的,官方都有對應(yīng)的寫法,可以看說明
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也不是必須的。具體的還是看官方文檔吧,不多說了。
相關(guān)文章
用IIS建立的.net網(wǎng)站通過IP地址不能訪問解決方法
用iis建立一個.net的網(wǎng)站,在iis中綁定了服務(wù)器公網(wǎng)ip的80端口和127.0.0.1的80端口,結(jié)果用ip地址不能直接訪問2014-05-05IIS7配置ASP詳細錯誤信息發(fā)送到瀏覽器顯示的方法
最近由于某種需要升級到了iis7,發(fā)現(xiàn)跟2003區(qū)別比較大,由于調(diào)試程序需要知道asp的錯誤信息,這里簡單分享下iis7中顯示asp錯誤信息的方法2014-07-07阿里云Windows 2008一鍵安裝包配置php web環(huán)境圖文安裝教程(IIS+Php+Mysql)
這篇文章主要介紹了阿里云Windows 2008一鍵安裝包配置web環(huán)境圖文安裝教程(IIS+Php+Mysql),當前使用2008 r2的朋友越來越多了,這個安裝包對于快速架設(shè)php運行環(huán)境是非常不錯的工具2016-10-10Windows Server 2019 DHCP服務(wù)器配置與管理——理論 Ⅰ
DHCP 是 Dynamic Host Configuration Protocol (動態(tài)主機配置協(xié)議)的縮寫2023-05-05IIS APPPOOL\DefaultAppPool 登錄失敗的解決方法
為大家介紹下解決IIS APPPOOL\DefaultAppPool 登錄失敗的方法,有遇到類似問題的朋友參考下2013-10-10Windows server 2016 安裝oracle的教程圖解
這篇文章主要介紹了Windows server 2016 安裝oracle的教程圖解,本文圖文并茂給大家介紹的非常詳細,具有一定的參考借鑒價值,需要的朋友可以參考下2019-06-06Windows Server 2003服務(wù)器無法下載.exe文件的解決方法
這篇文章主要介紹了Windows Server 2003服務(wù)器無法下載.exe文件的解決方法,實際上是服務(wù)器的安全設(shè)置沒有做好,包含了可執(zhí)行文件權(quán)限,取消即可,需要的朋友可以參考下2014-06-06Win2003 IIS6 使用.net framework 4.0 后默認文檔失效解決方案
這篇文章主要介紹了Win2003 IIS6 使用.net framework 4.0 后默認文檔失效解決方案,需要的朋友可以參考下2017-03-03win2003 創(chuàng)建 IP安全策略來屏蔽端口的圖文教程
IP安全性(Internet Protocol Security)是Windows XP/2003中提供的一種安全技術(shù),它是一種基于點到點的安全模型,可以實現(xiàn)更高層次的局域網(wǎng)數(shù)據(jù)安全性。2010-04-04