Posted by Shawn DeArmond on October 3, 2011 at 11:37pm
7 followers
Jump to:
| Project: | Oracle driver |
| Version: | 7.x-1.x-dev |
| Component: | Documentation |
| Category: | support request |
| Priority: | minor |
| Assigned: | Unassigned |
| Status: | needs review |
Issue Summary
Obviously, this has been successful for a number of people. I did finally get it installed on Ubuntu 10.04 Desktop 32bit, with much frustration. However, I never got it working on 64bit server.
Can someone point me to useful step-by-step instructions for getting a LAMP setup with PDO_OCI installed and working in Ubuntu Server? Preferably, I'd like to use 10.04 Lucid 64bit. If this is known to not work, or if a different version of Ubuntu Server is preferred, I'd like to know that too. I'm going to connect to an external Oracle server, so I don't need to know how to install the Oracle server stuff.
Thanks!
Comments
#1
What issues did you encounter on 64-bit that were not present on 32? Was it with compiling the PDO_OCI driver or something during the actual install process?
#2
My issues were mostly that there is no good documentation, and what I ended up doing, I only managed to scrape from a half-dozen different articles spread across different linux versions, all advising to install stuff in different places. I honestly have no idea what I did that actually got the the 32bit working. I know it involved installing a bunch of different stuff from Oracle, pecl, and apt-get, patching some of it in random ways, and attempting to compile each time.
It finally worked with 32bit, but, like I said, I'm not likely to easily replicate my process.
I'm working on attempting a 64bit Lucid server install in the next week or two, and I hope to completely document my process. I'm just hoping that maybe somebody has written something definitive that would help me.
#3
I wrote a how to here http://inode.me/tutorials/how-to-drupal-7-oracle-xe-install which you may have already seen. Mine is on 32-bit only because Oracle doesn't release 10g XE in 64. I believe they did release the beta of 11g in 64 though. Anyway, I really don't see what difference there would be with 32/64-bit or the version of Linux for that matter. Why don't you try on a 64-bit and then post something when you have an error?
#4
Okay, I got it to work by throwing together a bunch of articles that I found on the web. Here is the documentation that seemed to work for me. Some of these commands I'm not sure WHY I had to do them (the article just said "Do this, trust me"). Also, even though it worked, I may have gotten instantclient 11.1 and 11.2 confused. So if there are unnecessary steps, or other fine-tuning that can be done, let's correct them here so we can submit a good docs page in the handbook.
All this time, I'm thinking: Why is this so hard? I guess it's mostly because PDO_OCI hasn't been updated since 2005.
Oracle Clients on 10.04 Ubuntu Server 64-bit
10.04.3 installer image
## During Installation, select these server types:
LAMP Server
OpenSSH Server
## Download Oracle OCI clients for Linux:
http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html
## Download to /usr/lib/oracle/:
instantclient-basic-linux-x86-64-11.2.0.2.0.zip
instantclient-sqlplus-linux-x86-64-11.2.0.2.0.zip
instantclient-sdk-linux-x86-64-11.2.0.2.0.zip
## Unzip files to instantclient_11_2/ and rename repository
$ sudo apt-get install unzip$ cd /usr/lib/oracle/
$ sudo unzip instantclient-basic-linux-x86-64-11.2.0.2.0.zip
$ sudo unzip instantclient-sqlplus-linux-x86-64-11.2.0.2.0.zip
$ sudo unzip instantclient-sdk-linux-x86-64-11.2.0.2.0.zip
$ sudo mv instantclient_11_2 instantclient
## Setup $ORACLE_HOME and associated links
$ cd ~
$ vi .bashrc
#Insert the following lines to the bottom of .bashrc
export ORACLE_HOME=/usr/lib/oracle/instantclient
export LD_LIBRARY_PATH=$ORACLE_HOME/
export TNS_ADMIN=/etc
export NLS_LANG=AMERICAN_AMERICA.UTF8
#Exit vi (ZZ)
$ source .bashrc
## Install extra php stuff
$ sudo apt-get install php5-dev php-pear php-db php-gd php5-curl$ sudo apt-get install build-essential libaio1
## The installers all look for stuff in the wrong place. These links make it so it doesn't matter.
$ sudo su -$ ln -s libclntsh.so.* libclntsh.so
$ ln -s libocci.so.* libocci.so
$ echo /usr/lib/oracle/instantclient >> /etc/ld.so.conf
$ ldconfig
#Install OCI8
$ pecl install oci8
prompt> shared,instantclient,/usr/lib/oracle/instantclient
# Create a file: /etc/php5/cli/conf.d/oci8.ini
extension=oci8.so
# More links so the installers don't get confused.
$ cd /usr/include/
$ ln -s php5 php
$ cd /usr/lib/oracle/instantclient
$ mkdir -p include/oracle/11.1/
$ cd include/oracle/11.1/
$ ln -s ../../../sdk/include client
$ cd -
$ mkdir -p lib/oracle/11.1/client
$ cd lib/oracle/11.1/client
$ ln -s ../../../../ lib
## Download PDO_OCI
$ mkdir -p /tmp/pear/download/$ cd /tmp/pear/download/
$ pecl download pdo_oci
$ tar xvf PDO_OCI*.tgz
$ cd PDO_OCI*
## Patch PDO_OCI since it hasn't been updated since 2005
# copy the lines below into the file "config.m4.patch"
*** config.m4 2005-09-24 17:23:24.000000000 -0600--- config.m4 2009-07-07 17:32:14.000000000 -0600
***************
*** 7,12 ****
--- 7,14 ----
if test -s "$PDO_OCI_DIR/orainst/unix.rgs"; then
PDO_OCI_VERSION=`grep '"ocommon"' $PDO_OCI_DIR/orainst/unix.rgs | sed 's/[ ][ ]*/:/g' | cut -d: -f 6 | cut -c 2-4`
test -z "$PDO_OCI_VERSION" && PDO_OCI_VERSION=7.3
+ elif test -f $PDO_OCI_DIR/lib/libclntsh.$SHLIB_SUFFIX_NAME.11.1; then
+ PDO_OCI_VERSION=11.1
elif test -f $PDO_OCI_DIR/lib/libclntsh.$SHLIB_SUFFIX_NAME.10.1; then
PDO_OCI_VERSION=10.1
elif test -f $PDO_OCI_DIR/lib/libclntsh.$SHLIB_SUFFIX_NAME.9.0; then
***************
*** 119,124 ****
--- 121,129 ----
10.2)
PHP_ADD_LIBRARY(clntsh, 1, PDO_OCI_SHARED_LIBADD)
;;
+ 11.1)
+ PHP_ADD_LIBRARY(clntsh, 1, PDO_OCI_SHARED_LIBADD)
+ ;;
*)
AC_MSG_ERROR(Unsupported Oracle version! $PDO_OCI_VERSION)
;;
## Build and install PDO_OCI
$ patch --dry-run -i config.m4.patch$ patch -i config.m4.patch
$ phpize
$ ORACLE_HOME=/usr/lib/oracle/instantclient ./configure --with-pdo-oci=instantclient,/usr/lib/oracle/instantclient,11.1
$ make
$ make test
$ make install
## Add extensions to PHP
# Create /etc/php5/apache2/conf.d/pdo_oci.ini
extension=pdo_oci.so## restart Apache
$ /etc/init.d/apache2 restart## Install Drupal, Drush, Oracle client, etc. like normal.
#5
thanks Shawn for the contributed docs... i hope someone find the time to review it and patch the INSTALL.txt ;)
#6
#7
You might use Zend Server CE for a ready to use Oracle stack. even though it includes, it's own apache etc. It's easy to start from scratch. It comes preinstalled with some goodies (or bloatware) and it's ready for prod too.
#8
I got it working!! Here is my revised version of this howto:
Installing the PHP_OCI driver for Oracle databases
This step-by-step was adapted from the Ubuntu howto above. It worked for me on Debian/Linux64 Lenny (5.0) in the year 2012. As I wrote up this howto I tested a few things and ran into a new error... but my initial run through was successful. Good luck!
Please note: the patch you will do uses "11.1" as the version number. It will work with version 11.2 and later (but unless you update the patch, you should continue using "11.1" in the ./configure command).
## Download the following instantclient files from Oracle's website
http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html
unzip instantclient-basic-linux-x86-64-11.2.0.2.0.zipunzip instantclient-sdk-linux-x86-64-11.2.0.2.0.zip
## Move the files to our install location, /usr/lib/oracle/instantclient
mkdir /usr/lib/oraclemv instantclient_11_2/ /usr/lib/oracle/instantclient
## Fix some poorly named files and add them to our system's library index:
cd /usr/lib/oracle/instantclientln -s libclntsh.so.* libclntsh.so
ln -s libocci.so.* libocci.so
echo /usr/lib/oracle/instantclient >> /etc/ld.so.conf
ldconfig
## Fix more stupid paths:
mkdir -p include/oracle/11.1/
cd include/oracle/11.1/
ln -s ../../../sdk/include client
cd /usr/lib/oracle/instantclient
mkdir -p lib/oracle/11.1/client
cd lib/oracle/11.1/client
ln -s ../../../../ lib
## Download PDO_OCI
mkdir -p /tmp/pear/download/cd /tmp/pear/download/
pecl download pdo_oci
tar -xvzf PDO_OCI*.tgz
cd PDO_OCI*
## Patch PDO_OCI since it hasn't been updated since 2005
# copy the lines below into the file "config.m4.patch"
*** config.m4 2005-09-24 17:23:24.000000000 -0600--- config.m4 2009-07-07 17:32:14.000000000 -0600
***************
*** 7,12 ****
--- 7,14 ----
if test -s "$PDO_OCI_DIR/orainst/unix.rgs"; then
PDO_OCI_VERSION=`grep '"ocommon"' $PDO_OCI_DIR/orainst/unix.rgs | sed 's/[ ][ ]*/:/g' | cut -d: -f 6 | cut -c 2-4`
test -z "$PDO_OCI_VERSION" && PDO_OCI_VERSION=7.3
+ elif test -f $PDO_OCI_DIR/lib/libclntsh.$SHLIB_SUFFIX_NAME.11.1; then
+ PDO_OCI_VERSION=11.1
elif test -f $PDO_OCI_DIR/lib/libclntsh.$SHLIB_SUFFIX_NAME.10.1; then
PDO_OCI_VERSION=10.1
elif test -f $PDO_OCI_DIR/lib/libclntsh.$SHLIB_SUFFIX_NAME.9.0; then
***************
*** 119,124 ****
--- 121,129 ----
10.2)
PHP_ADD_LIBRARY(clntsh, 1, PDO_OCI_SHARED_LIBADD)
;;
+ 11.1)
+ PHP_ADD_LIBRARY(clntsh, 1, PDO_OCI_SHARED_LIBADD)
+ ;;
*)
AC_MSG_ERROR(Unsupported Oracle version! $PDO_OCI_VERSION)
;;
## Attempt to compile (this is where you're probably stuck, make sure you're in your PDO_OCI folder!)
export ORACLE_HOME=/usr/lib/oracle/instantclientpatch --dry-run -i config.m4.patch
patch -i config.m4.patch
phpize
./configure --with-pdo-oci=instantclient,/usr/lib/oracle/instantclient,11.1
make
make test
make install
## Add extensions to PHP
# Create /etc/php5/apache2/conf.d/pdo_oci.ini
extension=pdo_oci.so## restart Apache
/etc/init.d/apache2 restartCongratulations you made it!
## install Drupal!
Read the INSTALL file in the Drupal oracle module. It must be put in a special place in Drupal's filesystem!
#9
Awesome! That worked perfectly, thank you! You've ended many hours of frustration!