Install Concrete5
Install OCI8 dependencies on Concrete5 server
sudo apt-get install build-essential php5-dev php-pear libaio1
- 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"
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/
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
- Restart Apache2
service apache2 restart
- 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.
- 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'); } ?>
- 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; ?>
- Run php script from command line, it should connect to your Oracle database and list all tables available.
php ./dbtest.php
Loading Conversation