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

About this Entry

This page contains a single entry by Pank published on September 2, 2010 7:48 PM.

PieTTY 0.4.00b11 was the previous entry in this blog.

NextTV Player is the next entry in this blog.

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

Monthly Archives