• Join Now
  • Sign In
  • Cart
  • Instant Setup
  • Download
Logo
  • About
    • For Developers
    • For Agencies
    • For Designers
    • For Anyone
    • Testimonials
    • Showcase
    • Our Philosophy
    • Blog
    • Instant Setup
  • Community
    • Members
    • Forums
    • Chat
    • Karma
    • International
    • Jobs
    • eNewsletters
  • Developers
    • Download concrete5
    • Join Beta Team
    • Translate concrete5
    • Bug Tracker
    • Submit to Marketplace
    • Code Submissions
    • News
    • Community Leaders
    • Related Projects
  • Marketplace
    • Add-Ons
    • Themes
    • Hosting
    • Training
    • Add-on Installation
    • Deal Of The Day
    • Swag
  • Enterprise
  • Documentation
    • Getting Started
    • Editor's Guide
    • Learn concrete5
    • Developers Index
    • How-Tos
  • How-Tos

External Oracle database connection

Posted by xucchini in Developers on Jan 31, 2012.
4 people like this.
  1. Install Concrete5

  2. Install OCI8 dependencies on Concrete5 server

sudo apt-get install build-essential php5-dev php-pear libaio1
  1. Edit /etc/environment to add some system-wide environment vars to support OCI8
LD_LIBRARY_PATH="/usr/local/lib/instantclient_11_2"
TNS_ADMIN="/usr/local/lib/instantclient_11_2"
ORACLE_BASE="/usr/local/lib/instantclient_11_2"
ORACLE_HOME="/usr/local/lib/instantclient_11_2"
  1. Obtain Oracle Instant Client by going to http://www.oracle.com/ , select Downloads, select Instant Client, select Instant Client for Linux x86-64 and then download instantclient-basic-linux.x64-11.2.0.3.0.zip and instantclient-sdk-linux.x64-11.2.0.3.0.zip save them somewhere like /tmp/

  2. Install OCI

cd /usr/local/lib/
unzip /tmp/instantclient-basic-linux.x64-11.2.0.3.0.zip    
unzip /tmp/instantclient-sdk-linux.x64-11.2.0.3.0.zip
cd instantclient_11_2
ln -s libclntsh.so.11.1 libclntsh.so
pecl install oci8

When prompted type in

instantclient,/usr/local/lib/instantclient_11_2

Create file /etc/php5/conf.d/oci8.ini and place the following in it:

extension=oci8.so
  1. Restart Apache2
service apache2 restart
  1. Create /var/www/phpinfo.php and place inside the following:
<?php echo phpinfo() ?>

You should now have OCI8 installed. Browse to your http://your.site/phpinfo.php and verify that you see a section titled OCI8.

  1. Create a file in /var/www/concrete5.5.1 named concrete5cli.php inside place the following:
<?php
# concrete5cli.php
# Originally obtained from:
# http://www.concrete5.org/community/forums/documentation_efforts/how-to-running-concrete5-from-php-command-line/
define('DIR_BASE','.');
define('C5_ENVIRONMENT_ONLY', true);
require_once('config/site.php');
if ( !defined('REDIRECT_TO_BASE_URL') ){
  define('REDIRECT_TO_BASE_URL', false);
}
if ( defined('DIRNAME_APP_UPDATED') ){
  $GLOBALS['APP_UPDATED_PASSTHRU'] = true;
  require('updates/' . DIRNAME_APP_UPDATED . '/concrete/dispatcher.php');
}
else{
  require('index.php');
}
?>
  1. Create a file in /var/www/concrete5.5.1/ named dbtest.php and place inside:
    <?php
    # dbtest.php
    require('concrete5cli.php');
    $host = "db server hostname or IP";
    $port = "db port";
    $sid  = "db name";
    $connect_string = "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=$host)(PORT=$port)) (CONNECT_DATA=(SID=$sid)))";
    $user = "db username";
    $        pass = "db password";
    $db = Loader::db($connect_string,$user,$pass);
    $result = $db->Execute('show tables');
    if ($result === false) die("failed");
    while ($array = $result->FetchRow()) {
        print_r($array);
    }
    exit;
    ?>
  1. Run php script from command line, it should connect to your Oracle database and list all tables available.
    php ./dbtest.php

How-To Tags

concrete5 oci oci8 adodb ubuntu

Related How-Tos

None.

  • Documentation
  • How-Tos
  • Developers
  • External Oracle database connection

Do you have questions

  • What are users saying?
  • Who is using concrete5?
  • What makes concrete5 easy?
  • Why develop on concrete5?
 

We’re on “The Twitter”

RT @WebPhilM: I've now built over 30 sites in #Concrete5 over the last 2 years - and I've had almost no client issues with upgrades or func…

Follow concrete5

About

  • For Developers
  • For Agencies
  • For Designers
  • For Anyone
  • Testimonials
  • Showcase
  • Our Philosophy
  • Blog
  • Instant Setup

Community

  • Members
  • Forums
  • Chat
  • International
  • Jobs
  • eNewsletters

Developers

  • Download concrete5
  • Join Beta Team
  • Translate concrete5
  • Bug Tracker
  • Beta
  • Submit to Marketplace
  • Code Submissions
  • News
  • Community Leaders
  • User Doc Group
  • Related Projects

Marketplace

  • Add-Ons
  • Themes
  • Hosting
  • Training
  • Add-on Installation
  • Deal Of The Day
  • Swag

Documentation

  • Getting Started
  • Editor's Guide
  • Learn concrete5
  • Developers Index
  • How-Tos

Legal

  • Privacy Policy
  • Terms of Use
  • Refund Policy
  • Contact Us
© 2008 to 2013 Concrete CMS Inc. All Rights Reserved.

Sign In?

You must have a user account and be signed to perform this action.

  • Sign In
  • Register