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
  2. Installation
$  yum install oracle-instantclient18.3-basic-
$  yum install oracle-instantclient18.3-devel-
$  yum install oracle-instantclient18.3-sqlplus-
$	echo "/usr/lib/oracle/18.3/client64/lib/" > /etc/
$  /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 - Production on Fri Sep 21 20:16:22 2018

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

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


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

Install oci8 extension

  1. Installation
$  wget
$  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, 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
extension = "/usr/local/php-5.6.24/lib/php/extensions/no-debug-non-zts-20131226/"

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