linux Installation of OCI client and php installation of oci8 extension

linux Installation of OCI client and php installation of oci8 extension

oci client installation

  1. Download package
    oracle-instantclient18.3-basic-18.3.0.0.0-1.x86_64.rpm
    oracle-instantclient18.3-devel-18.3.0.0.0-1.x86_64.rpm
    oracle-instantclient18.3-sqlplus-18.3.0.0.0-1.x86_64.rpm
  2. Installation
$  yum install oracle-instantclient18.3-basic-18.3.0.0.0-1.x86_64.rpm
$  yum install oracle-instantclient18.3-devel-18.3.0.0.0-1.x86_64.rpm
$  yum install oracle-instantclient18.3-sqlplus-18.3.0.0.0-1.x86_64.rpm
$	echo "/usr/lib/oracle/18.3/client64/lib/" > /etc/ld.so.conf.d/oracle_client.conf
$  /sbin/ldconfig
$  CFLAGS="-I/usr/include/oracle/18.3/client64"
$  CXXFLAGS="-I/usr/include/oracle/18.3/client64/"
  1. Connect to database
$ /usr/lib/oracle/18.3/client64/bin/sqlplus64 usr/pwd@//host:port/sid
SQL*Plus: Release 18.0.0.0.0 - Production on Fri Sep 21 20:16:22 2018
Version 18.3.0.0.0

Copyright (c) 1982, 2018, Oracle.  All rights reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options

SQL>

If you can use sqlplus to connect to Oracle, the installation is basically successful

Install oci8 extension

  1. Installation
$  wget http://pecl.php.net/get/oci8-2.0.10.tgz
$  tar -xf oci8-2.0.10.tgz
$  phpize
$  ./configure --with-oci8=shared,instantclient,/usr/lib/oracle/18.3/client64/lib --with-php-config=/usr/local/php/bin/php-config
$  make
$  make test
$  make install
  1. View installation
$  php -m 

The display information includes oci8, indicating that the installation is successful

  1. Download package
    Now, oci8.so will be generated in no-debug-non-zts-20131226/ of all versions of php in the system,
    Add the following code in php.ini according to the specific path
[oci8]
extension = "/usr/local/php-5.6.24/lib/php/extensions/no-debug-non-zts-20131226/oci8.so"

Now you can operate oracle in php file!

Tags: Oracle PHP RPM sqlplus

Posted on Sat, 28 Dec 2019 11:08:50 -0500 by zfred09