Oracle DB

From DreamFactory
Jump to: navigation, search
Line 1: Line 1:
 
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
+
# Configure Pear (if not previously done)
 +
#* <source lang="bash">$ touch $(brew --prefix php70)/lib/php/.lock && chmod 0644 $(brew --prefix php70)/lib/php/.lock</source>
 
# Get the Instant Client Files
 
# Get the Instant Client Files
 
#* 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]
 
#* 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]
Line 18: Line 19:
 
#* <source lang="bash">$ sudo pecl install oci8</source>
 
#* <source lang="bash">$ sudo pecl install oci8</source>
 
#* When asked for the ORACLE_HOME directory during install type <code>instantclient,/usr/local/include/instantclient_12_1</code>
 
#* When asked for the ORACLE_HOME directory during install type <code>instantclient,/usr/local/include/instantclient_12_1</code>
#* You should see a message indicating that the oci8.so was successfully installed to the extensions directory
+
#* You should see a message indicating that the oci8.so was successfully installed to the extensions directory and enabled.
# Create the oci8.ini file using Nano
+
#* <source lang="bash">$ sudo nano /etc/php/7.0/mods-available/oci8.ini</source>
+
#* Edit the file so that it simply says <code>extension=oci8.so</code>
+
#* Save and exit the file
+
# Enable the module in PHP
+
#* <source lang="bash">$ sudo phpenmod oci8</source>
+
 
# Verify the module is successfully working with PHP
 
# Verify the module is successfully working with PHP
 
#* <source lang="bash">$ php -m | grep oci8</source>
 
#* <source lang="bash">$ php -m | grep oci8</source>

Revision as of 19:15, 2 November 2016

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.

  1. Configure Pear (if not previously done)
    • $ touch $(brew --prefix php70)/lib/php/.lock && chmod 0644 $(brew --prefix php70)/lib/php/.lock
  2. Get the Instant Client Files
    • Download the basic and sdk instant client files for Linux x86-64, version 12.1 from this link: Oracle Instant Client Downloads
    • Filenames:
      • instantclient-basic-linux.x64-12.1.0.2.0.zip
      • instantclient-sdk-linux.x64-12.1.0.2.0.zip
  3. Copy the instant client files to your Downloads directory (~/Downloads) on the server
  4. Unzip and move the files to /usr/local/include/instantclient_12_1
    • $ cd ~/Downloads
    • $ unzip instantclient-basic-macos.x64-12.1.0.2.0.zip
    • $ unzip instantclient-sdk-macos.x64-12.1.0.2.0.zip
    • $ mv instantclient_12_1 /usr/local/include/
  5. Create a symlink for the .so in the instantclient directory
    • $ ln -s /usr/local/include/instantclient_12_1/libclntsh.dylib.12.1 /usr/local/include/instantclient_12_1/libclntsh.dylib
  6. Install the oci8 driver using PECL
    • $ sudo pecl install oci8
    • When asked for the ORACLE_HOME directory during install type instantclient,/usr/local/include/instantclient_12_1
    • You should see a message indicating that the oci8.so was successfully installed to the extensions directory and enabled.
  7. Verify the module is successfully working with PHP
    • $ php -m | grep oci8