Connect PHP to the Oracle database in a Win764-bit System

Source: Internet
Author: User
The project encountered a problem, that is, how to connect to Oracle for development in Windows. Almost all examples are based on Mysql, and Oracle connection itself is complicated on Windows. Here is a short story

The project encountered a problem, that is, how to connect to Oracle for development in Windows. Almost all examples are based on Mysql, and Oracle connection itself is complicated on Windows. Here is a short story

The following describes the configuration process.

1. Download oracle instantclient

:

Download instantclient-basic-windows.x64-11.2.0.4.0

Decompress path: D: \ Program Files (x86) \ Oracle64Client \ instantclient_11_2

* Note: The client must have the corresponding database version.

2. configure system environment variables

Add:; D: \ Program Files (x86) \ Oracle64Client \ instantclient_11_2 to the path environment variable.

3. Configure PHP to support OCI Extension

Modify the configuration file php. ini

The configuration is as follows:

4. Restart the Apache service for testing

Use the probe function phpinfo () to check whether the extension is enabled. If so, the extension is enabled.

V. Test Database Connection

Write oracle. php In the root directory of the site. I am connected to the Oralce database in the CentOS virtual machine.

The Code is as follows:

<? Php $ conn = ocilogon ('test', 'test', '192. 168.23.131: 192/dev'); if (! $ Conn) {$ Error = oci_error (); print htmlentities ($ Error ['message']); exit;} else {echo "Connected Oracle Successd! "."
"; Ocilogoff ($ conn) ;}?>

Enter the address bar of the browser

Show Connected Oracle Successd! The database is successfully connected.

,

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.