Oracle DB

From DreamFactory
Jump to: navigation, search
Line 1: Line 1:
 +
== Driver ==
 
This module will allow you to access Oracle databases. These instructions assumes you are installing with the latest Oracle instant client (12.1) which is backwards compatible to Oracle 10. If you need compatibility back to Oracle 9, use the 11.2 instant client files from Oracle, and adjust the filenames in the instructions accordingly.
 
This module will allow you to access Oracle databases. These instructions assumes you are installing with the latest Oracle instant client (12.1) which is backwards compatible to Oracle 10. If you need compatibility back to Oracle 9, use the 11.2 instant client files from Oracle, and adjust the filenames in the instructions accordingly.
  
# Get the prerequisites
+
=== Requirements ===
#* <source lang="bash">$ sudo apt-get install unzip php-pear php7.1-dev build-essential libaio1</source>
+
* You will need the following items from your package manager (linux)
# Get the Instant Client Files
+
** PHP Pear and PHP Dev (for PECL)
#* Download the basic and sdk instant client files for Linux x86-64, version 12.1 from this link: [http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html Oracle Instant Client Downloads]
+
** Development tools / (e.g. Build Essential tools)
#* Filenames:
+
** libaio1
#** instantclient-basic-linux.x64-12.1.0.2.0.zip
+
* For Windows you will just need an oci8 dll file from PHP PECL (or from Bitnami)
#** instantclient-sdk-linux.x64-12.1.0.2.0.zip
+
* Oracle Instant Client Files
# Copy the instant client files to your home directory (~) on the server
+
** Download the basic and sdk instant client files: [http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html Oracle Instant Client Downloads]
# Unzip and move the files to <code>/opt/instantclient_12_1</code>
+
** Example Filenames:
#* <source lang="bash">$ cd ~</source>
+
*** instantclient-basic-linux.x64-12.1.0.2.0.zip
#* <source lang="bash">$ unzip instantclient-basic-linux.x64-12.1.0.2.0.zip</source>
+
*** instantclient-sdk-linux.x64-12.1.0.2.0.zip
#* <source lang="bash">$ unzip instantclient-sdk-linux.x64-12.1.0.2.0.zip</source>
+
 
#* <source lang="bash">$ sudo mv instantclient_12_1 /opt/</source>
+
=== Driver Install ===
# Create a symlink for the .so in the instantclient directory
+
* 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.
#* <source lang="bash">$ sudo ln -s /opt/instantclient_12_1/libclntsh.so.12.1 /opt/instantclient_12_1/libclntsh.so</source>
+
* 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.
# Install the oci8 driver using PECL
+
 
#* <source lang="bash">$ sudo pecl install oci8</source>
+
For concrete examples, see the [[../../../APT/Ubuntu_16.04/Modules/Oracle_DB| Ubuntu 16.04]] instructions or the [[../../../Bitnami_Windows/Modules/Oracle_DB| Bitnami Windows]] instructions.
#* When asked for the ORACLE_HOME directory during install type <code>instantclient,/opt/instantclient_12_1</code>
+
#* You should see a message indicating that the oci8.so was successfully installed to the extensions directory
+
# Create the ini file
+
#* <source lang="bash">$ sudo sh -c 'echo "extension=oci8.so" > /etc/php/7.1/mods-available/oci8.ini'</source>
+
# Enable the module in PHP
+
#* <source lang="bash">$ sudo phpenmod oci8</source>
+
# Verify the module is successfully working with PHP
+
#* <source lang="bash">$ php -m | grep oci8</source>
+

Revision as of 18:36, 28 February 2018

Driver

This module will allow you to access Oracle databases. These instructions assumes you are installing with the latest Oracle instant client (12.1) which is backwards compatible to Oracle 10. If you need compatibility back to Oracle 9, use the 11.2 instant client files from Oracle, and adjust the filenames in the instructions accordingly.

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.