Oracle DB

From DreamFactory
Jump to: navigation, search
(Oracle Instant Client Instructions for Linux)
Line 45: Line 45:
<source lang=javascript>
<source lang=javascript>
$ touch /etc/
$ touch /etc/

Revision as of 17:06, 7 November 2018



  • You will need the following items from your package manager (linux)
    • PHP Pear and PHP Dev (for PECL)
    • Development tools / (e.g. Build Essential tools)
    • libaio1
  • For Windows you will just need an OCI8 dll file from PHP PECL (or from Bitnami)
  • Oracle Instant Client Files
    • Download the basic and sdk instant client files: Oracle Instant Client Downloads
    • Example Filenames:

Driver Install

  • In Linux you will need to use PECL to build the OCI8 module, pointing to the unzipped instant client files as the library. Then enable the module in PHP.
  • In Windows you will need to add the unzipped instant client files to your PATH variable and restart the machine. Then enable the module in PHP.

For concrete examples, see the Ubuntu 16.04 instructions or the Bitnami Windows instructions.

Oracle Instant Client Instructions for Linux

Begin by navigating to and download an appropriate Oracle Instant Client and SDK. You can't download these files directly from your Linux server because Oracle requires you to accept a license agreement and additionally sign into your Oracle account (free registration) before completing the download.

Download the desired packages. For instance on Ubuntu, Debian, and other Linux variants we've downloaded the following packages:


SSH into your Linux machine and create the following directory:

$ mkdir /opt/oracle

Transfer the downloaded packages to this directory and unzip both, beginning with the basic (non SDK) package:

$ unzip
$ unzip

It is important to follow this sequence because the SDK package will unzip into the directory created by the basic package. If you're using a fresh Linux instance you may need to install the unzip package.

Next you'll add the instant client directory to ldconfig:

$ touch /etc/

Open this newly created file and add the following line:


Next you'll need to install a few PHP and system packages. Use your package manager to do so, on Debian/Ubuntu you'd use apt install for instance:

$ apt install php-dev php-pear build-essential libaio1

If you're running an earlier version of PHP (for example 7.1) then you will need to modify the PHP package names to look like php7.1-dev, php7.1-pear, etc.

Next, install the oci8 PHP extension:

$ pecl install oci8
downloading oci8-2.1.8.tgz ...
Starting to download oci8-2.1.8.tgz (194,154 bytes)
.................................done: 194,154 bytes
11 source files, building
running: phpize
Configuring for:
PHP Api Version:         20170718
Zend Module Api No:      20170718
Zend Extension Api No:   320170718
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] : instantclient,/opt/oracle/instantclient_18_3

IMPORTANT: Note you are prompted to provide the path to the ORACLE_HOME directory. The required format is rather odd, and it must be followed precisely. You must specify the string instantclient followed by a comma, followed by the path to the instantclient directory. For example:


Finally, you'll just need to add the extension reference to your php.ini file. You likely have *two* php.ini files on your server, one for the CLI and one for the web server. You can learn more about their locations by running:

$ php --ini

Note however this will only identify the CLI php.ini file path because we're running PHP via the CLI. However the php.ini file used in conjunction with the web server is also typically found in this path. For instance on Debian 8 the respective paths are:


Open each file and append the following line to the bottom of each:

extension =

After saving the files, run the following command to confirm the PHP CLI sees the OCI8 extension:

$ php -m | grep oci

Remember you'll need to restart your web server to ensure any changes to the web-related php.ini file take effect. Once complete, you should be able to generate an Oracle API via your DreamFactory web administration console.

Don't Need Oracle?

DreamFactory's Silver and Gold licenses include the Oracle connector by default, however if you don't require Oracle support and therefore don't install the OCI8 extension then you'll encounter the following error:

Problem 2
 - Installation request for yajra/laravel-oci8 v5.5.8 -> satisfiable by yajra/laravel-oci8[v5.5.8].
 - yajra/laravel-oci8 v5.5.8 requires ext-oci8 >=2.0.0 -> the requested PHP extension oci8 is missing from your system.

You can forgo the Oracle extension requirement by following these instructions:

Open composer.json and delete this block:

  "type": "vcs",
  "url":  ""

Scroll further down composer.json, and remove the line beginning with dreamfactory/df-oracledb":

When removing these lines, be sure to remove the concluding comma, and leave the preceding comma intact.

Save your changes, and run the following command from your project's root directory:

$ composer update dreamfactory/df-oracledb --ignore-platform-reqs

If you instead run composer install --ignore-platform-reqs after making this change, you'll see the following warning:

Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated 
dependencies. Run update to update them.

This isn't a particularly big deal, however in the interests of ensuring your composer.json and composer.lock files are synchronized, run the aforementioned composer update command after the composer install command completes, at which point you are done.