Installing OCI8 on the CentOS

    1. Download the RPM instant client package from oracle website. Since it is Linux environment, use the this oracle linkInstall the RPMs as the root user
      rpm –ivh  oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm
      rpm –ivh  oracle-instantclient12.1-devel-12.1.0.2.0-1.x86_64.rpm
      rpm –ivh oracle-instantclient12.1-sqlplus-12.1.0.2.0-1.x86_64.rpm
    2. Install some prerequisite

yum install php-pear
yum install php-devel

  1. Set environment variables ORACLE_HOME and LD_LIBRARY_PATH# ORACLE_HOME=/usr/lib/oracle/12.1/client64; export ORACLE_HOME
    # LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATHYou should also add the above two lines in ~/.bash_profile file. Edit the file by vi editor and add the lines above PATH=$PATH:$HOME/bin#vim  ~/.bash_profile

    # .bash_profile
    # Get the aliases and functions
    if [ -f ~/.bashrc ]; then
    . ~/.bashrc
    fi# User specific environment and startup programsORACLE_HOME=/usr/lib/oracle/12.1/client64; export ORACLE_HOME
    LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
    PATH=$PATH:$HOME/binexport PATH

     

  2. Check you have php-pear and php-devel packages installed by this command. You must have these package installed
    1. # rpm -qa | grep -i php
    2. php-5.3.3-3.el6_1.3.x86_64
    3. php-cli-5.3.3-3.el6_1.3.x86_64
    4. php-devel-5.3.3-3.el6_1.3.x86_64
    5. php-common-5.3.3-3.el6_1.3.x86_64
    6. php-mysql-5.3.3-3.el6_1.3.x86_64
    7. php-soap-5.3.3-3.el6_1.3.x86_64
    8. php-pear-1.9.4-4.el6.noarch
    9. php-gd-5.3.3-3.el6_1.3.x86_64
  3.  Install oci8 installation# pecl install oci8
  4. if you unable to install above command, try to download latest version of PECL according to your PHP version
  5. create ‘src’ directory under /user/local
  6. use scp command#scp -r /Users/aoza002c/Desktop/CentOS/1/oci8-2.1.3/    root@xfwappa-ho-01q.sys.comcast.net:/usr/local/src/# cd /user/local/src/oci8-2.1.3
    #phpize
    #./configure –with-oci8=shared,instantclient,/usr/lib/oracle/12.1/client64/lib/
    #make install
  7. if you see below fatal error
    #export PHP_DTRACE=yes
  8. Add the folowing configuration at the end of php.ini#vi /etc/php.ini
    extension=oci8.so
  9. Restart Apache #service httpd restart

Below links for more reference:

http://techinfobest.com/install-oci8/

http://php.net/manual/en/oci8.installation.php

http://antoine.hordez.fr/2012/09/30/howto-install-oracle-oci8-on-rhel-centos-fedora/

http://techinfobest.com/connect-oracle-database-from-php-in-redhatcentos/

http://bytefreaks.net/applications/oracle/installing-oracle-sqlplus-on-centos

This entry was posted in Others and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *