Oracle DB Installation

From DreamFactory
Jump to: navigation, search
DreamFactoryInstallationDatabasesOracle DB Installation

Drivers

Requirements

  • 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:
      • instantclient-basic-linux.x64-12.1.0.2.0.zip
      • instantclient-sdk-linux.x64-12.1.0.2.0.zip

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 http://www.oracle.com/technetwork/database/database-technologies/instant-client/downloads/index.html and download an appropriate Oracle Instant Client such as Instant Client for Linux x86-64. You can't download this file 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 package and transfer it to your server. Unzip the file and move the directory to /usr/local/lib. If your using a fresh Linux instance you may need to install the unzip package.

Next you'll download the OCI8 PECL extension using the following command:

$ cd /tmp
$ pecl download OCI8
downloading oci8-2.1.8.tgz ...
Starting to download oci8-2.1.8.tgz (194,154 bytes)
.....done: 194,154 bytes
File /tmp/oci8-2.1.8.tgz downloaded

If you're using a fresh Linux install you may need to install pecl. This is however not available as a standalone package; it's part of the phpX.Y-dev package (replace X.Y with the PHP version running on your instance).

Next you'll want to untar and unzip the oci8-2.1.8.tgz extension:

$ tar zxvf oci8-2.1.8.tgz
package.xml
oci8-2.1.8/tests/array_bind_001.phpt
oci8-2.1.8/tests/array_bind_002.phpt
...
oci8-2.1.8/php_oci8.h
oci8-2.1.8/php_oci8_int.h
oci8-2.1.8/README

Next, enter the oci8-2.1.8 directory and build the extension:

$ cd oci8-2.1.8
$ phpize
$ ./configure --with-oci8=instantclient,/usr/local/lib/instantclient_18_3
$ sudo make install
  1. cd /etc/php/7.0/mods-available/
  2. Create a file named oci8.ini and add extension=oci8.so to it. Save the file.
  3. sudo ln -s /etc/php/7.0/mods-available/oci8.ini /etc/php/7.0/cli/conf.d/20-oci8.ini
  4. sudo systemctl restart nginx
  5. sudo service php7.0-fpm restart

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":  "https://github.com/dreamfactorysoftware/df-oracledb"
},

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.