Oracle 10g Instant Client (free download available) is the easiest way for PHP to connect to a remote Oracle database, requiring installation of only three libraries.
The Instant Client libraries used by PHP access Oracle's current API, called OCI8. (This C interface takes its name from being first introduced in Oracle8.) PHP Oracle 8 Functions can call Oracle 8.1.7, 9.x, or 10.x directly, or optional abstraction classes like PEAR MDB2 and ADOdb can be used for convenience.
The older PHP "oracle" extension can also be used with Instant Client but it calls a deprecated Oracle API. New development with this extension is not recommended by the PHP community or by Oracle.
To use Instant Client with PHP 4 or 5 on Apache, follow the steps below. (See this section for details about 5.1.2 and its refactored OCI8 extension.) An existing Oracle database is needed; Instant Client does not include one.
Typically the database will be on another machine. If the database is local then Oracle components will generally already be available and Instant Client is not required.
Software Requirements:
Software |
Notes |
Oracle Instant Client |
Download the "Instant Client Package - Basic." On Linux, also download the "Instant Client Package - SDK." |
Apache HTTPD Server |
The PHP community still recommends Apache 1.3 |
PHP - PHP Hypertext Processor |
Version 4.3 or later |
Enabling the PHP OCI8 Extension on Windows
The Instant Client binaries complement PHP's prebuilt binaries for Windows.
-
Download the PHP binary zip file (not the installer build) and Apache. Install them following Installation on Windows Systems in the PHP Manual. OTN's PHP Developer Center contains links to useful background material such as "Installing Oracle, PHP, and Apache on Windows 2000/XP," which covers installation of a traditional, full Oracle 10g footprint (which is not required with Instant Client).
Check that PHP is working before continuing. At this stage Oracle support is not enabled.
-
Download the Instant Client Basic package for Windows from the Instant Client page on OTN. The zip file is about 30MB in size.
-
Create a subdirectory (e.g., c:\instantclient10_1) and copy these libraries from the zip file:
- oraociei10.dll
- orannzsbb10.dll
- oci.dll
Collectively these three files are about 80MB in size.
To use PHP's older "oracle" extension (enabled with "extension=php_oracle.dll" in php.ini), copy ociw32.dll instead of oci.dll.
-
Edit the environment and add c:\instantclient10_1 to PATH before any other Oracle directories.
For example, on Windows 2000, follow Start -> Settings -> Control Panel -> System -> Advanced -> Environment Variables and edit PATH in the System variables list.
If a tnsnames.ora file is used to define Oracle Net service names, copy tnsnames.ora to c:\instantclient10_1 and set the user environment variable TNS_ADMIN to c:\instantclient10_1. A default service name can optionally be set in the user environment variable LOCAL.
Set necessary Oracle globalization language environment variables such as NLS_LANG. If nothing is set, a default local environment will be assumed. See An Overview on Globalizing Oracle PHP Applications for more details.
Unset unnecessary Oracle variables such as ORACLE_HOME and ORACLE_SID.
-
Edit php.ini and uncomment the OCI8 extension:
Set the extension_dir directive to the full PHP extension DLL path. In PHP 4 the DLLs are in the "extensions" sub-directory of the PHP software. In PHP 5 they are in "ext".
extension=php_oci8.dll
-
Restart Apache.
To check the extension is configured, create a simple PHP script phpinfo.php where the web server can read it.
Load the script into a browser using an "http://" URL. The browser page should contain an "oci8" section saying "OCI8 Support enabled".
<?php
phpinfo();
?>
分享到:
相关推荐
instantclient-basic-win64-10.2.0.5.zip instantclient-basic-windows.x64-11.2.0.4.0.zip instantclient-basic-windows.x64-12.1.0.2.0.zip instantclient-basic-windows.x64-12.2.0.1.0.zip instantclient-basic-...
linux服务器上 oracle instantclient 客户端。Oracle Instant client 是oracle提供的简便客户端, 支持多种平台。 内容包含 oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpm oracle-instantclient11.2-...
Oracle Instant Client 11.2.0.1.0是轻量级Oracle客户端,用于连接访问Oracle 9i、10g、11g 11.2.0.1.0版本的Oracle数据库。 Oracle Instant Client11.2.0.1.0 安装程序包含OCI/ OCCI、JDBC-OCI SDK(软件开发工具...
instantclient-basic-win64-10.2.0.5.zip instantclient-basiclite-win64-10.2.0.5.zip instantclient-jdbc-win64-10.2.0.5.zip instantclient-sqlplus-win64-10.2.0.5.zip instantclient-sdk-win64-10.2.0.5.zip ...
oracle-instantclient-basic-21.6.0.0.0-1.x86_64.rpm oracle-instantclient-basic-21.6.0.0.0-1.x86_64.zip oracle-instantclient-devel-21.6.0.0.0-1.x86_64.rpm oracle-instantclient-sqlplus-21.6.0.0.0-1.x86_...
Oracle Instant Client 12 C Oracle12C客户端解压可用,内含配置说明
instantclient-basic-win32-10.1.0.5-20060419 instantclient-basic-win32-10.2.0.5 instantclient-basic-win32-11.1.0.7.0 instantclient-basic-nt-11.2.0.4.0 instantclient-basic-nt-12.1.0.2.0 instantclient-...
32位Oracle 客户端,在64位系统中安装该Instant Client后可使用PLSQL进行访问。
oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpm oracle-instantclient11.2-basiclite-11.2.0.4.0-1.x86_64.rpm oracle-instantclient11.2-devel-11.2.0.4.0-1.x86_64.rpm oracle-instantclient11.2-jdbc-...
Instant Client 是 ORACLE(R) 发布的轻量级数据库客户端,您无需安装标准的客户端,就可以通过它来运行 OCI、OCCI、Pro*C、ODBC 和 JDBC 程序。...注: 此版本:instantclient-basic-nt-11.2.0.3.0
oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpm oracle-instantclient11.2-basiclite-11.2.0.4.0-1.x86_64.rpm oracle-instantclient11.2-devel-11.2.0.4.0-1.x86_64.rpm oracle-instantclient11.2-jdbc-...
oracle10G 连接提示缺少oci.dll Instant Client for Microsoft Windows
Instant Client 是 ORACLE(R) 发布的轻量级数据库客户端,您无需安装标准的客户端,就可以通过它来运行 OCI、OCCI、Pro*C、ODBC 和 JDBC 程序。 适用于那些仅需要连接远程 Oracle 数据库,本地不需要安装服务端的...
oralce客户端,instantclient-basic-windows.x64-11.2.0.4.0 使用本地开发环境需通过PLSQL连接Oracle数据库, 不需要安装oracle数据库。
oracle数据库instantclient_11_2,连接,使用navicat连接oracle11,亲测有用
oracle-instantclient11.2-sqlplus-11.2.0.4.0-1.x86_64.ziporacle-instantclient11.2-sqlplus-11.2.0.4.0-1.x86_64.ziporacle-instantclient11.2-sqlplus-11.2.0.4.0-1.x86_64.ziporacle-instantclient11.2-sqlplus...
oracle instant client 32位,提供使用方法,链接如下: http://blog.csdn.net/s592652578/article/details/79447996
Oracle Instant client 是oracle提供的简便客户端, 支持多种平台. 可从oracle网站下载,我这里为了方便上传到这儿,navacat for oracle15亲测可用!
instantclient-basic-windows.x64-19.16.0.0.0dbru.zip instantclient-sqlplus-windows.x64-19.16.0.0.0dbru.zip instantclient-tools-windows.x64-19.16.0.0.0dbru.zip
plsql developer安装的是64位,在连接远程oracle时会出现Could not initalize oci.dll警告,原因分析:需要加载 oci.dll 是64位的相关的文件