How to Make PHP support Oracle

Source: Internet
Author: User

PHP is recommended to operate Oracle databases by using the OCI8 extension.

The method for enabling PHP OCI8 extension on the internet is roughly as follows:

(1) Remove the comments of extension = php_oci8.dll in php. ini (first use phpinfo to check where your php. ini is located and do not change it to the wrong one.

Make sure that the php_oci8.dll file is in the directory specified by the extension_dir parameter.

(2) Restart Webserver.

Today, I performed the preceding steps on a machine without Oracle installation, but the OCI8 extension is still unavailable.

Later, I found on the Internet that this situation may be caused by the lack of several key DLL files in Oracle. you can install the Oracle Instant Client to add these DLL files.

The Oracle Instant Client is as follows:

Http://download.oracle.com/auth/otn/nt/instantclient/112010/instantclient-basic-win32-11.2.0.1.0.zip? E = 1291455905 & h = b028eef8e7f3831a30ca778d77582963


After the download, decompress it to C: \ instantclient_11_2 (unfixed location) and add the PATH to the beginning of the system PATH environment variable.

Restart the Webserver and view the phpinfo. You can view the OCI8 module information.

To sum up, follow these steps to enable the PHP OCI8 extension:

(1) Remove the comments before extension = php_oci8.dll in php. ini.


(2) install the Oracle Instant Client and add the installation directory to the system PATH environment variable.

Note: This step is important to add environment variables.


 

(3) restart the Webserver and use phpinfo to check whether the OCI8 module appears.

 

The following is an official Oracle Installation instruction, which is detailed:

Nstalling PHP and the Oracle Instant Client for Linux and Windows

Http://www.oracle.com/technetwork/articles/technote-php-instant-084410.html

In addition, I feel good about the PHP Oracle operations:

Http://wiki.oracle.com/page/PHP+Oracle+FAQ

A pdf Working PHP and Oracle file. The link is as follows;

Http://blogs.oracle.com/alisonHolloway/gems/ahollowaosdc2006.pdf

OCI8 PHP manual for Oracle operations:

Http://php.net/manual/en/book.oci8.php

Finally, add oci to the path environment variable.

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.