PHP connection Oracle and simple operation

Source: Internet
Author: User
Tags sql
To enable your PHP to support Oracle, follow these steps: 1. Install the PHP environment, look for Appserv or XAMPP, one-click installation, very convenient 2. The PHP ext directory under the Php_oci8.dll copy to the System32 directory 3. Modify the configuration in the php.ini file, remove; extention = Php_oci8.dll, remove the preceding semicolon 4. Restart Apache two ways and build links to Oracle databases 1. $conn = Oci_connect (' username ', ' p Assword ', "(Description= (address= (PROTOCOL =tcp) (host=192.168.1.100) (PORT = 1521)) (Connect_data = (sid=test)))");  2. $conn = Oci_connect (' username ', ' password ', ' 192.168.1.100/test ');   Sometimes the first way is not, use the second, the inside of several parameters are user name, password, Oracle service address, where test is the service name.  $sql = "SELECT * from Table_exmaple" $ora _test = Oci_parse ($conn, $sql);  Compile SQL statement Oci_execute ($ora _test,oci_default);   Execute while ($r =oci_fetch_row ($ora _test))//Fetch result {echo $ora _test[0]; echo "<BR>"; }

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.