How to install oci8 in Centos7 and Ubuntu

OCI8 Installation.

https://www.oracle.com/database/technologies/instant-client/linux-x86-64-downloads.html


 # yum install php-devel systemtap-sdt-devel php-pear


# yum install oracle-instantclient12.2-basic-12.2.0.1.0-1.x86_64.rpm oracle-instantclient12.2-devel-12.2.0.1.0-1.x86_64.rpm oracle-instantclient12.2-sqlplus-12.2.0.1.0-1.x86_64.rpm oracle-instantclient12.2-tools-12.2.0.1.0-1.x86_64.rpm


# ldconfig


# export PHP_DTRACE=yes


# pecl install oci8-2.2.0


downloading oci8-2.2.0.tgz ...

Starting to download oci8-2.2.0.tgz (196,449 bytes)

.........................................done: 196,449 bytes

11 source files, building

running: phpize

Configuring for:

PHP Api Version:         20190902

Zend Module Api No:      20190902

Zend Extension Api No:   320190902

Please provide the path to the ORACLE_HOME directory. Use 'instantclient,/path/to/instant/client/lib' if you're compiling with Oracle Instant Client [autodetect] : Enter

-----

------

------

Build complete.

Don't forget to run 'make test'.


running: make INSTALL_ROOT="/var/tmp/pear-build-rootx3fTor/install-oci8-2.2.0" install

Installing shared extensions:     /var/tmp/pear-build-rootx3fTor/install-oci8-2.2.0/usr/lib64/php/modules/

running: find "/var/tmp/pear-build-rootx3fTor/install-oci8-2.2.0" | xargs ls -dils

205570119   0 drwxr-xr-x 3 root root     17 Nov  4 17:45 /var/tmp/pear-build-rootx3fTor/install-oci8-2.2.0

136708230   0 drwxr-xr-x 3 root root     19 Nov  4 17:45 /var/tmp/pear-build-rootx3fTor/install-oci8-2.2.0/usr

205570120   0 drwxr-xr-x 3 root root     17 Nov  4 17:45 /var/tmp/pear-build-rootx3fTor/install-oci8-2.2.0/usr/lib64

   395320   0 drwxr-xr-x 3 root root     21 Nov  4 17:45 /var/tmp/pear-build-rootx3fTor/install-oci8-2.2.0/usr/lib64/php

 71494377   0 drwxr-xr-x 2 root root     21 Nov  4 17:45 /var/tmp/pear-build-rootx3fTor/install-oci8-2.2.0/usr/lib64/php/modules

 71494378 676 -rwxr-xr-x 1 root root 691056 Nov  4 17:45 /var/tmp/pear-build-rootx3fTor/install-oci8-2.2.0/usr/lib64/php/modules/oci8.so


Build process completed successfully

Installing '/usr/lib64/php/modules/oci8.so'

install ok: channel://pecl.php.net/oci8-2.2.0

configuration option "php_ini" is not set to php.ini location

You should add "extension=oci8.so" to php.ini


# vim /etc/php.ini 


============================================================


OCI8 Installation. Ubuntu 

https://medium.com/@dhanza/setup-apache2-php-oci8-on-ubuntu-20-04-d9e5b400f3fa

https://www.oracle.com/database/technologies/instant-client/linux-x86-64-downloads.html


After we got all the components like apache2, php and the oracle client, now we follow the steps below :


    extract oracle instant client basic and sdk

   # unzip instantclient-basic-linux.x64–12.2.0.1.0.zip

   # unzip instantclient-sdk-linux.x64–12.2.0.1.0.zip

    make a folder /opt/oracle, and then move the extracted folder there

   # mkdir /opt/oracle

   # mv instantclient_12_2 /opt/oracle/instantclient

    change the ownership of folder

    # chown -R root:www-data /opt/oracle/instantclient

    install dependencies needed for oracle installation

    # apt-get install php7.4-dev php-pear build-essential libaio1

    make symbolic lynx for library needed for installation

  #  ln -s /opt/oracle/instantclient/libclntsh.so.12.1 /opt/oracle/instantclient/libclntsh.so

  #  ln -s /opt/oracle/instantclient/libocci.so.12.1 /opt/oracle/instantclient/libocci.so

    add instantclient folder to ldconfig, and then update it

   #  echo /opt/oracle/instantclient > /etc/ld.so.conf.d/oracle-instantclient.conf

    # ldconfig

    install oci8, and then enter this parameter when it requested

    # pecl channel-update pecl.php.net

   # pecl install oci8–2.2.0

    instantclient,/opt/oracle/instantclient

    add oci8 extension into php configuration

    # echo " extension = oci8.so " >> /etc/php/7.4/cli/php.ini

    # echo " extension = oci8.so " >> /etc/php/7.4/apache2/php.ini

    and instantclient environment configuration

   # echo "LD_LIBRARY_PATH=\"/opt/oracle/instantclient\"" >> /etc/environment

   # echo "ORACLE_HOME=\"/opt/oracle/instantclient\"" >> /etc/environment

   #  echo "LD_LIBRARY_PATH=\"/opt/oracle/instantclient\"" >> /etc/apache2/envvars

   #  echo "ORACLE_HOME=\"/opt/oracle/instantclient\"" >> /etc/apache2/envvars

    restart server

    test the application with phpinfo script. if it shown like this picture below then the installation is success


Comments

Popular posts from this blog

How to install and configure node js and PM2 in rhel7

PCS Corosync Pacemaker Cluster Mariadb using NFS

How to Create or Configure iSCSI Server and Clinet