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