PHP provides Oracle support for adding OCI8 modules

Source: Internet
Author: User

Environment: CentOS7 x86_64

PHP 7.1.2 (Installation path:/usr/local/php7.1.2)

Oracle 11G R2



1. Download the Oracle client: (http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html)

Instantclient-basic-linux.x64-11.2.0.4.0.zip

Instantclient-sdk-linux.x64-11.2.0.4.0.zip


2. Download the PHP Oracle module

wget http://pecl.php.net/get/oci8-2.1.4.tgz


3. Installing dependent Packages

Yum-y install autoconf automake gcc libaio-devel unzip


4. Installation

CD ~unzip Instantclient-basic-linux.x64-11.2.0.4.0.zipunzip INSTANTCLIENT-SDK-LINUX.X64-11.2.0.4.0.ZIPCP instantclient_11_2/libclntsh.so.11.1 Instantclient_11_2/libclntsh.sotar zxf oci8-2.1.4.tgzcd oci8-2.1.4/usr/local/ Php7.1.2/bin/phpize./configure--with-php-config=/usr/local/php7.1.2/bin/php-config--with-oci8=instantclient,/ Instantclient_11_2 make && make installecho ' extension = "oci8.so" ' >>/usr/local/php7.1.2/etc/php.ini


5. Testing

/usr/local/php7.1.2/bin/php-m |grep Ocioci8
<?php$conn = Oci_connect (' username ', ' password ', ' 192.168.1.100/ORCL '); $sql = "SELECT * FROM table_name"; $ora _test = Oci_parse ($conn, $sql), Oci_execute ($ora _test,oci_default), while ($r =oci_fetch_row ($ora _test)) {echo $r [0 ];   echo "<BR>"; }?>



This article is from "Maple Night" blog, please be sure to keep this source http://fengwan.blog.51cto.com/508652/1934773

PHP provides Oracle support for adding OCI8 modules

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.