PHP+IIS7配置OCI8链接Oracle 10G的方法
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之类的也不是必须的,官方都有对应的写法,可以看说明
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也不是必须的。具体的还是看官方文档吧,不多说了。
相关文章
Windows Server2022 DHCP服务器配置(图文)
本文详细介绍了在Windows 2022系统中配置DHCP服务器的方法,包括IP地址范围、租约期限等设置,具有一定的参考价值,感兴趣的可以了解一下2023-09-09事件ID( 54 )的描述(在资源( HTTP )中)无法找到
事件 ID ( 54 )的描述(在资源( HTTP )中)无法找到。。.. \Device\Http\AppPool.本地计算机可能没有必要的注册信息或消息 DLL 文件来从远程计算机显示消息。您可能可以使用 /AUXSOURCE= 标识来检索词描述;查看帮助和支持以了解详细信息。2008-07-07win server2019 IIS10设置上传大小限制的方法实现
IIS10与之前的IIS6的版本是没有很多差别的,IIS10默认上传文件大小为30M,本文主要介绍了winserver2019 IIS10设置上传大小限制的方法实现,感兴趣的可以了解一下2024-04-04没有ISAPI Rewrite FULL照样玩多站点伪静态的方法分享
IIS中增加URL Rewrite功能,最多人选用的是名为“ISAPI Rewrite“的软件,网上下载的破解版,其实破解不完善,最终会不能用2011-11-11IIS提示Server Application Error的解决方法集锦
The server has encountered an error while loading an application during the processing of your request. Please refer to the event log for more detail information. Please contact the server administrator for assistance.2011-01-01Window Server服务器拨号失败error/1058的问题的解决方法
这篇文章主要介绍了Window Server服务器拨号失败error/1058的问题的解决方法,需要的朋友可以参考下2023-04-04
最新评论