Linux RedHat - Oracle installing pdo_oci and oci8 modules

Ask a question
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-10.2.0.1-1.0.i386.rpm
  • 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>    
#phpize    
  • 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:

#phpize    
#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:

extension=pdo_oci.so  
  • At this point simply restart the web server.

Notes


Thanks to wjaouadi for this tip
Jean-François Pillou

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.

Learn more about the CCM team