Welcome to the Oracle community forum and interact with 2 million technical staff. Accessing Oracle10gInstantClient is the easiest way for PHP to connect to a remote Oracle database. It only requires three libraries to be installed. The InstantClient library used by PHP to access Oracle's current API is called OCI8.
Welcome to the Oracle Community Forum, interact with 2 million technical staff> accessing the Oracle 10g Instant Client is the easiest way for PHP to connect to a remote Oracle database. It only requires three libraries to be installed. The Instant Client library used by PHP to access Oracle's current API is called OCI8.
Welcome to the Oracle community forum and interact with 2 million technical staff> enter
Oracle 10g Instant Client is the easiest way to connect PHP to a remote Oracle database. It only needs to install three databases.
The Instant Client library used by PHP to access Oracle's current API is called OCI8. (the name of this C interface was first introduced in oracle8 .) PHP Oracle 8 functions can directly call Oracle 8.1.7, 9.x, or 10.x, or use optional abstract classes such as PEAR MDB2 and ADOdb for convenience.
The Instant Client can also use an earlier version of PHP "oracle" extension, but it calls an unsupported Oracle API. We recommend that you do not use this extension for new development in PHP or Oracle.
To use the Instant Client with PHP 4 in Apache, follow these steps. An existing Oracle database is required; Instant Client does not provide an Oracle database. Generally, this database is located on another computer. If the database is located locally, the Oracle component is generally already available, so that the Instant Client is not required.
Software requirements:
Software |
Notes |
Oracle Instant Client |
Download "Instant Client Package-Basic ". In Linux, you should also download "Instant Client Package-SDK ". |
Apache HTTPD Server |
Apache 1.3 is still recommended in the PHP Field |
PHP-PHP hypertext Processor |
Version 4.3 or later |
Enable PHP OCI8 extension on Windows
The Instant Client binary file is a supplement to PHP's Windows pre-built binary file.
Download PHP binary compressed files (not the installer version) and Apache. Install them on the Windows System in the PHP manual. OTN's Open-Source Developer Center contains links to useful background materials, such as "installing Oracle, PHP, and Apache on Windows 2000/XP ", it introduces how to install the traditional and Complete Oracle 10g version (this version is not required for Instant Client ).
Check whether PHP is running normally before continuing the operation. Oracle Support is not enabled at this stage.
Download the Instant Client Basic Package for Windows from the Instant Client page of OTN. The size of the compressed file is about 30 MB.
Create a sub-directory (for example, c: \ instantclient10_1) and copy the following library from the compressed file:
- Oraociei10.dll
- Orannzsbb10.dll
- Oci. dll
The total size of these three files is about 80 MB.
To use an earlier version of the "oracle" extension of PHP (Enabled with "extension = php_oracle.dll" in php. ini), copy ociw32.dll instead of oci. dll.
Edit this environment and add c: \ instantclient10_1 to PATH (before other Oracle Directories ).
For example, on Windows 2000, choose Start> Settings> Control Panel> system> advanced> environment variables ", edit the PATH in the system Variable list.
If the tnsnames. ora file is used to define the Oracle Net service name, copy tnsnames. ora to c: \ instantclient10_1 and set the user environment variable TNS_ADMIN to c: \ instantclient10_1. You can also define the default service name in the LOCAL environment variable.
Set the required Oracle global language environment variables, such as NLS_LANG. If this parameter is not set, the default local environment is used. For more details, see the overview of Oracle PHP application globalization.
You do not need to set unnecessary Oracle variables, such as ORACLE_HOME and ORACLE_SID.
Edit php. ini and do not set the OCI8 extension as a comment:
extension=php_oci8.dll
Set the extension_dir command to the complete PHP extension DLL path. In PHP 4, the DLL is located in the "extensions" subdirectory of the PHP software. In PHP 5, they are located in "ext.
Restart Apache.
[1] [2] [3]