Installing PHP and Oracle 10g Instant clients

Source: Internet
Author: User
Tags ini variables php and php software oracle database

Oracle 10g Instant Client is the easiest way to connect PHP to a remote Oracle database, and it only needs to install three libraries.

The Instant Client library used by PHP to access the current API for Oracle is called OCI8. (the name of this C interface was first introduced in Oracle8.) The PHP Oracle 8 function can call Oracle 8.1.7, 9.x, or 10.x directly, or you can use optional abstract classes such as PEAR MDB2 and ADOdb for convenience.

Instant Client can also use the older version of the PHP "Oracle" extension, but it invokes an Oracle API that is not in favor of using. The PHP community or Oracle recommends that you do not use this extension for new development.

To use Instant Client with PHP 4 on Apache, follow these steps. An existing Oracle database is required; Instant Client does not provide Oracle databases. Typically, this database will be located on another computer. If the database is local, the Oracle component is generally already available, thus eliminating the need for Instant Client.

Software Requirements:

Software Note
Oracle Instant Client Download "Instant Client package-basic".
On Linux, you should 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 higher

Enable the PHP OCI8 extension on Windows

The Instant Client binary is a complement to PHP's Windows pre-built binary file.

  1. Download the PHP binary compressed file (not the installer version) and Apache. Install them according to the installation on the Windows system in the PHP manual. OTN's Open Source Developer Center contains links to useful background information, such as "Installing Oracle, PHP, and Apache on Windows 2000/xp," which describes how to install the traditional, complete Oracle 10g version (Instant Client does not need this version This).

    Check to see if PHP is working properly before continuing. Oracle support is not enabled at this stage.

  2. Download the Instant client Basic package for Windows from the OTN Instant client page. The size of this compressed file is approximately 30MB.

  3. Create a subdirectory (for example, C:\instantclient10_1), and then copy the following libraries from the compressed file:

    • Oraociei10.dll
    • Orannzsbb10.dll
    • Oci.dll

    The total size of these three files is approximately 80MB.

    To use the older version of PHP's Oracle extension (enabled using "Extension=php_oracle.dll" in php.ini), copy the Ociw32.dll instead of Oci.dll.

  4. Edit this environment to add c:\instantclient10_1 to the PATH (before other Oracle directories).

    For example, on Windows 2000, click Start-> Settings-> Control Panel-> System-> advanced-> environment variables to edit PATH in the System variables list.

    If the Tnsnames.ora file is used to define an Oracle Net service name, the Tnsnames.ora is copied to c:\instantclient10_1 and the user environment variable tns_admin is set to C:\instantclient1 0_1. You can also define the default service name in the user environment variable Local.

    Set up the necessary Oracle global language environment variables, such as Nls_lang. If not set, the default local environment is used. For more detailed information, see Oracle PHP Application Globalization Overview.

    There is no need to set unnecessary Oracle variables, such as Oracle_home and Oracle_sid.

  5. Edit the php.ini and do not set the OCI8 extension as a comment:

    Extension=php_oci8.dll
    

    Set the EXTENSION_DIR directive to the full 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".

  6. Restart Apache.


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.