Linux: September 2010 Archives

Build PHP with OCI8

Vote 0 Votes

Environment: CentOS 5.5 x64

1. Download Oracle Instant Client basic and devel rpm and install
(You need to register an oracle account first)
rpm -ivh oracle-instantclient11.2-basic-
rpm -ivh oracle-instantclient11.2-devel-

2. Downlaod Extension for Oracle Database from PECL and install
pecl install oci8-1.4.3.tgz

3. Move to extension_dir (see your php.ini)
cp /usr/local/lib/php/extensions/no-debug-non-zts-20060613/ /usr/lib64/php/modules

4. add to php.ini
echo >> /usr/local/etc/php.ini

Verifying the oci8 extension is work
# php -i | grep OCI
OCI8 Support => enabled

Easy Connect Example:
$conn = oci_connect('user', 'password', '//');
// Use lsnrctl services in Oracle to list existing service name
$stid = oci_parse($conn, "select id from table");
oci_execute($stid, OCI_DEFAULT);
while ($arr = oci_fetch_array($stid, OCI_ASSOC)) {
echo "$arr[id].\n";

ref. Installing PHP and the Oracle Instant Client for Linux and Windows
PHP Oracle FAQThis is a featured page
PHP: oci_connect - Manual

Recent Entries

About this Archive

This page is an archive of entries in the Linux category from September 2010.

Linux: August 2010 is the previous archive.

Linux: October 2010 is the next archive.

Find recent content on the main index or look in the archives to find all content.

Monthly Archives