<

Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x

Setting up PHP to use Oracle Instant Client (oci8) under RHEL/Fedora/CentOS distributions

Published on
25,728 Points
22,228 Views
Last Modified:
Michael Worsham
Creative problem solver with ability to work either individually or through multiple teams partners for accomplishing goals.
Currently, there is not an RPM package available under the RHEL/Fedora/CentOS distributions that gives you a quick and easy way to allow PHP to interface with Oracle. As a result, I have included a set of instructions on how to do this with minimal time and effort.

To complete the steps, you you will need to get the Oracle Instant Client and the OCI8 PECL package.

Oracle Instant Client: http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/linuxsoft.html
PECL OCI8 Package: http://pecl.php.net/package/oci8

1) Install Apache, PHP, the Oracle Instant Client MySQL support if you want it and required development packages to build from source code.

    yum install httpd php php-mysql php-pear php-devel zlib zlib-devel
    yum groupinstall "Development Tools"

2) Add the Oracle instant client to dynamic linker

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

3) Untar the PECL package and prepare it for compiling

    tar -xzvf oci-.tgz
    cd oci-
    phpize

4) Configure the PECL package as a shared object using the instant client and specifying where the Oracle client libraries are. Then build and install it.

    ./configure --with-oci8=shared,instantclient,/usr/lib/oracle/N>/client/lib
    make
    make install

5) Add the library shared object for PHP

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

6) Start Apache

    'service httpd start' _or_ '/etc/init.d/httpd restart'

7) Create a PHP info page and checked to see if the Oracle (oci8) driver is listed:

    echo  > /var/www/html/phpinfo.php
 
0
Comment
2 Comments
 
LVL 29

Author Comment

by:Michael Worsham
Instruction #1: Under RedHat Linux defined distributions (i.e. CentOS, RHEL, Fedora), 'yum' [Yellow dog Updater, Modified (YUM)] is an open-source command-line package-management utility for RPM-compatible Linux operating systems.

Instruction #3: Tar (Tape Archiver) is both a file format (in the form of a type of archive bitstream) and the name of the program used to handle such files. The use of 'tar -zxvf <filename>.tgz' will uncompress the 'tarball', then extract the files & directories into the directory the file is originally located in.

Instruction #6: There are two ways to do it under RedHat Linux: 'service httpd start' _or_ '/etc/init.d/httpd restart'
0
 
 

Administrative Comment

by:WaterStreet
mwecomputers,

What you explained is that you have  intentionally phrased those instructions they way you did.  And, I was performing my basic editorial function by verifying that fact with you.  Fine.  We have completed that stage, and I could now promptly designate the Article as Published.

However,  you gave explanations that provide good value-added to your article.  One of the things that I tell the other editors when recommending articles for "Approved" and "Editors Choice" is that the articles should have clear explanations and definitions for technical jargon.  Those explanations you gave me would help the article, IMO.  Again, this is up to you.  I left the Article in Author Edit status, in case you want to incorporate those explanations into the Article.

Either way, let me know by placing the article back into Editor Review status, and I will then publish it.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Join & Write a Comment

Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Suggested Courses
Course of the Month12 days, 2 hours left to enroll

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month