A few words of thanks would be greatly appreciated.

Linux RedHat - Oracle installing pdo_oci and oci8 modules

A user will need an Oracle client before installing oci8 modules. There are various commands associated with Linux which the user has to define. After downloading the Oracle xe Client, the add-ons will also need to be installed. For the installation of oci8 modules, the user must unzip the oci package. After the launch of the command, the final step associated with Oracle and oci8 modules will be to add a shared library. For a step-by-step guide, have a look at the solution provided below...

Before installing pdo_oci and oci8 modules the presence of an Oracle client is needed.

Installing Oracle xe Client

  • The installation begins with the establishment of the prerequisite modules via the commands:

#yum install php-pear php-devel zlib zlib-devel    
#yum groupinstall "Development Tools"    
#yum install bc libaio.i386 glibc.i686    
  • Then it will install the rpm of the Oracle client, downloadable from the Oracle website.

#rpm-ivh oracle-xe-client-
  • Install add-ons:

#yum install oracle-lib-compat
  • Finally, add the Oracle instance in dynamic linker

#echo /usr/include/oracle/<VERSION>/client > /etc/ld.so.conf.d/oracle_client.conf    
#ldconfig -v

Installing oci8

  • It must be placed in an installation directory or unzip the oci package, downloadable here

#tar -xzvf oci-<VERSION>.tgz    
#cd oci-<VERSION>    
  • Then, simply launch the following command:

#./configure --with-oci8=./configure --with-oci8=/chemin/vers/client/oracle
  • Finally, we must add the shared library to php and restart the web server

#echo extension=oci8.so > /etc/php.d/oci8.ini

Installing pdo_oci

  • To install the pdo_oci module, we must first go to the installation directory and download the package via the command:

#pecl download pdo_oci
  • Note that: the package is provided at delivery and therefore this step can be replaced by a copy of tgz provided.
  • Then, unzip the package:

#tar xvfz PDO_OCI-1.0.tgz
  • For further manipulations go to the uncompressed directory level

#cd PDO_OCI-1.0 
  • Then run the commands:

#mkdir include    
#ln -s /usr/include/php5/ include/php
  • Finally, start the installation

#make && make install
  • To configure php and apache web server to support the module pdo_oci, we must add the following line to php.ini:

  • At this point simply restart the web server.


Thanks to wjaouadi for this tip

A few words of thanks would be greatly appreciated.

Ask a question
CCM is a leading international tech website. Our content is written in collaboration with IT experts, under the direction of Jeff Pillou, founder of CCM.net. CCM reaches more than 50 million unique visitors per month and is available in 11 languages.
This document, titled "Linux RedHat - Oracle installing pdo_oci and oci8 modules," is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (https://ccm.net/).