Enabling the PHP OCI8 Extension on Linux

  1. Install PHP and Apache. Check that PHP is working.
  2. Download the Basic and the SDK Instant Client packages from the OTN Instant Client page. Install the RPMs as the root user:
    rpm -Uvh oracle-instantclient11.1-basic-11.1.0.7.0-1.i386.rpm
    rpm -Uvh oracle-instantclient11.1-devel-11.1.0.7.0-1.i386.rpm
    The first RPM puts the Oracle libraries in /usr/lib/oracle/11.1/client/lib
    The second creates headers in /usr/include/oracle/11.1/client
  3. The latest OCI8 1.3 extension from PECL supercedes the default version in the PHP 5.2 source code. This can be downloaded manually and installed with:
    pecl install oci8-1.3.5.tgz
  4. This gives:
    downloading oci8-1.3.5.tgz …
    Starting to download oci8-1.3.5.tgz (137,987 bytes) …..done: 137,987 bytes
    10 source files, building running: phpize
    Configuring for:
    PHP Api Version:         20041225
    Zend Module Api No:      20060613
    Zend Extension Api No:   220060519
    Please provide the path to the ORACLE_HOME directory. Use ‘instantclient,/path/to/instant/client/lib’ if you’re compiling with Oracle Instant Client : autodetect 1-1, ‘all’, ‘abort’, or Enter to continue:
  5. Since we have installed the Instant Client RPMs, hit Enter and PECL will automatically locate the RPMs and build and install an oci8.so shared library.
  6. In php.ini, enable the OCI8 extension with: extension=oci8.so
  7. Verifying the Extension is Installed
  8. To check the extension is configured, create a simple PHP script phpinfo.php in the Apache document root:
    <?php
    phpinfo();
    ?>
  9. Load the script into a browser using the appropriate URL, e.g. “http://localhost/phpinfo.php”. The browser page will contain an “oci8″ section saying “OCI8 Support enabled”. The OCI8 options that can be configured in your php.ini file are shown.
Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.