Jul
19
2011
Submitted by Ash P.
First off, a big thank you to Andrea Gariboldi for making this possible with his Oracle Driver Project!!
This installation "how to" is done on openSUSE 11.3 with PHP 5.3 and Oracle 10g XE. Here are the steps I took to get my Drupal 7 site with an Oracle backend up and running. Just some preliminary steps that I won't get into too much detail about:
- Install Apache, Oracle XE, PHP
- Configure vhost and extract Drupal to 'DocumentRoot' directory
- As always, read the INSTALL file included with the driver (I did have to make some modifications though)
Now, many 'How To" article on PHP/Oracle go over installing both OCI8 and PDO_OCI extensions. You really only need PDO_OCI to get your Drupal site running. So let's get started!
- Compile the PDO_OCI extension
# tar -xzvf PDO_OCI-1.0.tgz
# ./configure --with-pdo-oci
Depending on the version of PDO_OCI you use you may get the following error:
checking for PDO includes... checking for PDO includes... configure: error: Cannot find php_pdo_driver.h.
--> Simply download the patch here: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=511900
# patch configure < configure.new
patching file configure Hunk #1 succeeded at 6058 (offset -991 lines).
# make install
Make sure to add "extension=pdo_oci.so" to your php.ini config files (both Apache/CLI) and then verify that PDO is using the OCI driver:
# php -i | grep PDO
PDO
PDO support => enabled
PDO drivers => oci
PDO_OCI
PDO Driver for OCI 8 and later => enabled
With phpinfo() you should see:

Also, make to sure set Oracle system variables (adjust to your environment) in "/etc/sysconfig/apache2":
export ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
2. I created a separate tablespace to use for Drupal. Here are the steps:
- Make a directory for the tablespace (# mkdir /var/www/htdocs/drupaldb)
- Make sure this directory is owned by user oracle (# chown oracle /var/www/htdocs/drupaldb)
Login to Oracle, create tablespace/user and grant permissions:
# sqlplus system
SQL*Plus: Release 10.2.0.1.0 - Production on Sat Feb 5 02:14:22 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Enter password:
Connected to:
Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
SQL> create tablespace drupal
2 logging
3 datafile '/var/www/htdocs/drupaldb/drupal.dbf'
4 size 32m
5 autoextend on
6 next 32m maxsize 3072m
7 extent management local;
Tablespace created.
SQL> create user drupal identified by password
2 default tablespace drupal
3 temporary tablespace temp;
User created.
SQL> grant unlimited tablespace to drupal;
Grant succeeded.
SQL> conn sys/password as sysdba
Connected.
SQL> grant execute on dbms_crypto to drupal;
Grant succeeded.
SQL> grant select on v_$sql_plan to drupal;
Grant succeeded.
SQL> grant select on v_$sqlarea to drupal;
Grant succeeded.
- I logged into APEX (Oracle's web interface to ALTER user drupal's permissions). If you are like me and installing on a remote server which you can't access on "http://127.0.0.1:8080/apex" run the following command:
SQL> EXEC DBMS_XDB.SETLISTENERLOCALACCESS(FALSE);
- You will now be able to access on http://xxx.xxx.xxx.xxx:8080/apex (set back to TRUE if you don't plan on regularly accessing APEX!!)
3. Download and copy the Oracle Driver to the appropriate directories:
# cd <path to drupal dir>/includes/database/
# tar xzvf <oracle-7.x-*.tar.gz>
# cd oracle/module
# mv oracle <path to drupal dir>/sites/all/modules
4. Begin the installation @ http://xxx.xxx.xxx.xxx/install.php
- I chose the 'Standard' profile & the English langauge
- Configure the DB. I'm using the default XE which comes configured in Oracle's Express Ed

- Click next and watch the install:

- Once complete, configure your new D7 install (login/pass/email) and login
- Go to Administration -> Modules and enable the Oracle module
- Go to Configuration -> Oracle (under Development Section) -> Blob and schedule a time to run a clean up

- And last, log back into to Oracle as the DB user (drupal in my case) and create linguistic indexes in your desired tablespace:
PL/SQL procedure successfully completed.
That's it!! This guide is based in the INSTALL file which comes packaged with the driver.