Oracle instantclient_21_12 oci8

Hello,

I set up Concrete5 v5.6.2.1 a while back which connects to external Oracle databases via adodb. Right now I am attempting to migrate some of that content to Concrete version 8.5.4. So on the 8.5.4 server I have installed oracle instantclient_21_12 basic, sdk, and sqlplus. I’ve confirmed I can connect and query the Oracle DB I need to access with sqlplus.

Right now I am having a difficult time finding documentation or guidance on how to configure Concrete to allow me to connect to Oracle. I see ./concrete/config/database.php and ./application/config/database.php files but an attempts to add a new section to ./application/config/database.php results in failure.

Does anyone have any guidance? It would be much appreciated!

Thank you.

Additional Information:
PHP Version 7.4.3-4ubuntu2.19

Related Loaded Modules:
OCI8
Oracle (OCI) driver for PDO

Related ini files:
/etc/php/7.4/apache2/conf.d/oci8.ini

In /application/config/database.php, you configure the second (or more) database connection. Details in

You should first get your 8.5.4 work stable, then update to 8.5.14 then update to 9.2.5. Version 8.5.4 is way out of date by now.

Thank you for the quick response and link to the documentation.

The documentation doesn’t address any database connections besides MySQL. I tried putting in Oracle related information like designating pdo_oci8 rather than c5_pdo_mysql.

I am guessing that a Oracle database driver is not included in c5 but can’t find any documentation on how to add database drivers.

This is something that used to work and was somewhat supported or at least had documentation for c5 v5.6

I do intend to update to Concrete CMS version 9 but need to work through some other PHP revisions first. However, if going to concrete cms version 9 made connecting to oracle databases much easier that would be a huge motivator for upgrading ASAP.

The database drivers are from Doctrine, so you would find docs on Doctrine or Symfony web sites.
I found Configuration - Doctrine Database Abstraction Layer (DBAL)

I have never connected to Oracle. For applications with Universal Content Puller I have used the database connection to work with SQLite sources and way back with an SQL Server source (can’t remember the details).

Right now tried modifying application/config/database.php with something along the lines of:
‘default-connection’ => ‘concrete’,
‘drivers’ => [
‘c5_pdo_mysql’ => ‘\Concrete\Core\Database\Driver\PDOMySqlConcrete5\Driver’,
#‘pdo_oci8’ => ‘Doctrine\DBAL\Driver\PDOOracle\Driver’
#‘pdo_oci8’ => ‘\Doctrine\DBAL\Driver\PDOOracle\Driver’
‘pdo_oci8’ => ‘\Doctrine\DBAL\Driver\OCI8\Driver’
#‘pdo_oci8’ => ‘Doctrine\DBAL\Driver\OCI8\Driver’
],
‘connections’ => [

‘dbname’ => [
‘driver’ => ‘pdo_oci8’,
‘server’ => ‘server:port’,
‘database’ => ‘dbname’,
‘username’ => ‘user’,
‘password’ => ‘pass’,
‘charset’ => ‘utf8’
],

but getting warning/error:

Use of undefined constant OCI_COMMIT_ON_SUCCESS - assumed ‘OCI_COMMIT_ON_SUCCESS’ (this will throw an Error in a future version of PHP)

I feel like I’m really close but not quite there.

That could be a missing driver, or a php8 issue if the connection class has not been updated since php7.

Hmm ok so when in c5 when I look at
/index.php/dashboard/system/environment/info

it does not list oci8 under php extensions, but if I run echo phpinfo()

in the apache root directory of c5 it does list oci8 under modules.

(looks like in PHP modules and extensions are interchangeable names for same thing)

Is there a best way to ask c5 to load a specific php extension?

Hello,

Eventually found the solution to my problem. Turned out that I needed to rename my /etc/ld.so.conf.d/oracle-instantclient to /etc/ld.so.conf.d/oracle-instantclient.conf and rerun ldconfig.

Contents of /etc/ld.so.conf.d/oracle-instantclient.conf is just a single line with a path to the libraries:

cat /etc/ld.so.conf.d/oracle-instantclient.conf

/usr/local/lib/instantclient_21_12

The relevant stanza contained in ./application/config/database.php might be useful to someone:

    'bannerdb' => [
        'driver' => 'pdo_oci8',
        'server' => 'DatabaseHostnameGoesHere',
        'port' => 'DatabasePortGoesHere',
        'servicename' => 'DatabaseOrSessionNameGoesHere',
        'username' => 'UsernameGoesHere',
        'password' => 'PasswordGoesHere',
        'charset' => 'utf8'
    ],
1 Like