Cool Tools - Adding oracle oci8 support with Coolstack 1.1

Hello All-

I'm hitting a roadblock. I'm trying to add in Oracle oci8 support for php, and I'm a bit lost on how to proceed. From what I can gather, I want to use phpize. Here's what I've tried so far:

Create the folder for Oracle instant client:

mkdir -p /opt/oracle/instantclient

Unzip the basic instant client and the sdk into that folder:

unzip instantclient-basic-solaris64-10.2.0.3-20070101.zip

unzip instantclient-sdk-solaris64-10.2.0.3-20070101.zip

cd /opt/oracle/instantclient

ln -s libclntsh.so.10.1 libclntsh.so

So now my /opt/oracle/instantclient folder looks like this:

# ls -al /opt/oracle/instantclient

total 209134

drwxr-xr-x3 rootroot 512 Mar 29 15:47 .

drwxr-xr-x3 rootroot 512 Mar 29 15:36 ..

-r--r--r--1 rootroot1600090 Dec 20 12:02 classes12.jar

-rwxr-xr-x1 rootroot35176 Dec 20 12:02 genezi

lrwxrwxrwx1 rootroot 17 Mar 29 15:47 libclntsh.so -> libclntsh.so.10.1

-rwxr-xr-x1 rootroot24230928 Dec 20 12:02 libclntsh.so.10.1

-rwxr-xr-x1 rootroot6955360 Dec 20 12:02 libnnz10.so

-rwxr-xr-x1 rootroot1417600 Dec 20 12:02 libocci.so.10.1

-rwxr-xr-x1 rootroot71008720 Dec 20 12:02 libociei.so

-rwxr-xr-x1 rootroot124200 Dec 20 12:02 libocijdbc10.so

-r--r--r--1 rootroot1545954 Dec 20 12:02 ojdbc14.jar

drwxr-xr-x4 rootroot 512 Mar 29 15:37 sdk

Set the paths that I think need to be set:

ORACLE_HOME=/opt/oracle/instantclient

export ORACLE_HOME

Here's what happens when I try to install:

/opt/coolstack/php5/bin/pecl install oci8

downloading oci8-1.2.3.tar ...

Starting to download oci8-1.2.3.tar (-1 bytes)

.........................................................................................................................................done: 681,984 bytes

10 source files, building

running: phpize

Configuringfor:

PHP Api Version: 20041225

Zend Module Api No:20060613

Zend Extension Api No:220060519

Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF

environment variable is set correctly and then rerunthis script.

ERROR: `phpize' failed

I added autoconf (from Sunfreeware) and put it in my path. I now get the error

/usr/local/bin/autoconf: /usr/local/bin/autom4te: not found

when I try to install. But the file /usr/local/bin/autom4te is indeed right where automake is looking...

I'm really at a lost as to whether this is even the right direction to be going. If anybody has any ideas, I'd appreciate it.

Thanks-

John

I've now added autoconf (from Sunfreeware). I now get the error that autom4te is not found. Any ideas?

[3092 byte] By [john.tracya] at [2007-11-26 23:24:45]
# 1

I found a few errors and I'm in the process of fixing:

Download and install autoconf (from sunfreeware):

gzip 杁 autoconf-2.60-sol10-sparc-local.gz

pkgadd -d autoconf-2.60-sol10-sparc-local

PATH=$PATH:/usr/local/bin/

export PATH

download m4-1.4.7-sol10-sparc-local.gz from sunfreeware

gzip 杁 m4-1.4.7-sol10-sparc-local.gz

pkgadd 杁 m4-1.4.7-sol10-sparc-local

edit /usr/local/bin/autom4te and fix the path to perl at the top (should be /opt/coolstack/bin/perl)

edit /usr/local/bin/autoheader and fix the path to perl at the top (should be /opt/coolstack/bin/perl)

download m4-1.4.7-sol10-sparc-local.gz from sunfreeware

gzip 杁 m4-1.4.7-sol10-sparc-local.gz

pkgadd 杁 m4-1.4.7-sol10-sparc-local

You also have to have a C compiler installed (duh). I thought Sun Studio 11 was on this box... but it wasn't. I'm installing now.

john.tracya at 2007-7-10 14:31:34 > top of Java-index,Open Source Technologies,OpenSPARC...
# 2

After installing Sun Studio 11, and adding /usr/ccs/bin to the path so that pecl could find ld, and entering in "instantclient,/opt/oracle/instantclient" when asked for the path to the Oracle instant client, I get this error:

ld: fatal: file /opt/oracle/instantclient/libclntsh.so: wrong ELF class: ELFCLASS64

ld: fatal: File processing errors. No output written to .libs/oci8.so

*** Error code 1

make: Fatal error: Command failed for target `oci8.la'

ERROR: `make' failed

I'm pretty sure this means it's trying to compile binaries for the wrong platform. In this case, I'm on a 64 bit Sparc platform. I double checked my Oracle Instant Client downloads, and I'm getting the ones they label as 64 bit Sparc on their website.

john.tracya at 2007-7-10 14:31:34 > top of Java-index,Open Source Technologies,OpenSPARC...
# 3

I went back and downloaded the 32 bit versions of the Oracle Instant Client and the Instant Client SDK and tried to compile against them. This time everything said it was successful:

-

Libraries have been installed in:

/var/tmp/pear-build-root/oci8-1.2.3/modules

If you ever happen to want to link against installed libraries

in a given directory, LIBDIR, you must either use libtool, and

specify the full pathname of the library, or use the `-LLIBDIR'

flag during linking and do at least one of the following:

- add LIBDIR to the `LD_LIBRARY_PATH' environment variable

during execution

- use the `-RLIBDIR' linker flag

See any operating system documentation about shared libraries for

more information, such as the ld(1) and ld.so(8) manual pages.

-

Build complete.

(It is safe to ignore warnings about tempnam and tmpnam).

running: make INSTALL_ROOT="/var/tmp/pear-build-root/install-oci8-1.2.3" install

Installing shared extensions:/var/tmp/pear-build-root/install-oci8-1.2.3/opt/coolstack/php5/lib/php/extensions/no-debug-non-zts-20060613/

running: find "/var/tmp/pear-build-root/install-oci8-1.2.3" -ls

3298141 drwxr-xr-x3 rootroot 512 Mar 29 17:06 /var/tmp/pear-build-root/install-oci8-1.2.3

3298461 drwxr-xr-x3 rootroot 512 Mar 29 17:06 /var/tmp/pear-build-root/install-oci8-1.2.3/opt

3298471 drwxr-xr-x3 rootroot 512 Mar 29 17:06 /var/tmp/pear-build-root/install-oci8-1.2.3/opt/coolstack

3298481 drwxr-xr-x3 rootroot 512 Mar 29 17:06 /var/tmp/pear-build-root/install-oci8-1.2.3/opt/coolstack/php5

3298491 drwxr-xr-x3 rootroot 512 Mar 29 17:06 /var/tmp/pear-build-root/install-oci8-1.2.3/opt/coolstack/php5/lib

3298501 drwxr-xr-x3 rootroot 512 Mar 29 17:06 /var/tmp/pear-build-root/install-oci8-1.2.3/opt/coolstack/php5/lib/php

3298511 drwxr-xr-x3 rootroot 512 Mar 29 17:06 /var/tmp/pear-build-root/install-oci8-1.2.3/opt/coolstack/php5/lib/php/extensions

3298521 drwxr-xr-x2 rootroot 512 Mar 29 17:06 /var/tmp/pear-build-root/install-oci8-1.2.3/opt/coolstack/php5/lib/php/extensions/no-debug-non-zts-20060613

329845 520 -rwxr-xr-x1 rootroot516840 Mar 29 17:06 /var/tmp/pear-build-root/install-oci8-1.2.3/opt/coolstack/php5/lib/php/extensions/no-debug-non-zts-20060613/oci8.so

Build process completed successfully

Installing '/var/tmp/pear-build-root/install-oci8-1.2.3//opt/coolstack/php5/lib/php/extensions/no-debug-non-zts-20060613/oci8.so'

install ok: channel://pecl.php.net/oci8-1.2.3

You should add "extension=oci8.so" to php.ini

Now I've got and added extension=oci8.so to my php.ini file, but when I to a phpinfo, it doesn't show the oci8.so module as loaded. Here's a copy of my php.ini (this should be the easy part!):

cat /opt/coolstack/php5/lib/php.ini

[PHP]

cgi.fix_pathinfo = 1

memory_limit = 64M; Maximum amount of memory a script may consume (8MB)

default_socket_timeout = 1800

[Session]

session.use_cookies = 1

session.cookie_lifetime = 0

session.gc_probability = 1

session.gc_divisor= 5000

session.gc_maxlifetime = 6000

session.entropy_file = "/dev/urandom"

;session.cache_expire = 300

;session.cache_limiter = nocache

;session.save_path = "5;/tmp"

include_path=/opt/coolstack/php5/lib/php:.:

extension_dir=/opt/coolstack/php5/lib/php/extensions/no-debug-non-zts-20060613

extension="mysql.so"

extension="mysqli.so"

extension="apc.so"

extension="oci8.so"

# hardened-php - uncomment to enable. See http://hardened-php.net

extension="suhosin.so"

apc.enabled=1

apc.shm_segments=1

apc.optimization=0

apc.shm_size=128

apc.ttl=120

apc.user_ttl=120

apc.gc_ttl=120

apc.stat=0

apc.num_files_hint=1024

apc.user_entries_hint=100

apc.mmap_file_mask=/dev/zero

;apc.enable_cli=1

; Allow or prevent persistent links.

;mysql.allow_persistent = On

; Maximum number of persistent links. -1 means no limit.

;mysql.max_persistent = -1

; Maximum number of links (persistent + non-persistent). -1 means no limit.

;mysql.max_links = -1

I'm getting this error in Apache's error_log on startup:

PHP Warning: PHP Startup: Unable to load dynamic library '/opt/coolstack/php5/lib/php/extensions/no-debug-non-zts-20060613/oci8.so' - ld.so.1: httpd: fatal: libnnz10.so: open failed: No such file or directory in Unknown on line 0

Running ldd on the troublesome module produces the following output (which I'm not really understanding):

ldd -d oci8.so

libclntsh.so.10.1 =>/opt/oracle/instantclient/libclntsh.so.10.1

libc.so.1 =>/lib/libc.so.1

libnnz10.so =>(file not found)

libkstat.so.1 => /lib/libkstat.so.1

libnsl.so.1 =>/lib/libnsl.so.1

libsocket.so.1 =>/lib/libsocket.so.1

libgen.so.1 =>/lib/libgen.so.1

libdl.so.1 =>/lib/libdl.so.1

libsched.so.1 => /usr/lib/libsched.so.1

libaio.so.1 =>/lib/libaio.so.1

librt.so.1 =>/lib/librt.so.1

libm.so.1 =>/lib/libm.so.1

libmp.so.2 =>/lib/libmp.so.2

libmd5.so.1 =>/lib/libmd5.so.1

libscf.so.1 =>/lib/libscf.so.1

libdoor.so.1 => /lib/libdoor.so.1

libuutil.so.1 => /lib/libuutil.so.1

symbol not found: core_globals (./oci8.so)

symbol not found: le_index_ptr (./oci8.so)

symbol not found: executor_globals (./oci8.so)

symbol not found: zend_standard_class_def(./oci8.so)

symbol not found: zend_ini_boolean_displayer_cb (./oci8.so)

symbol not found: OnUpdateBool (./oci8.so)

symbol not found: OnUpdateBool (./oci8.so)

symbol not found: OnUpdateLong (./oci8.so)

symbol not found: OnUpdateLong (./oci8.so)

symbol not found: OnUpdateLong (./oci8.so)

symbol not found: OnUpdateLong (./oci8.so)

symbol not found: OnUpdateLong (./oci8.so)

libm.so.2 =>/lib/libm.so.2

/platform/SUNW,Sun-Fire-V210/lib/libc_psr.so.1

/platform/SUNW,Sun-Fire-V210/lib/libmd5_psr.so.1

__

Your wisdom and insight are appreciated.

-John

john.tracya at 2007-7-10 14:31:34 > top of Java-index,Open Source Technologies,OpenSPARC...
# 4

ldd -f produced output that was a bit more helpful:

libclntsh.so.10.1 =>/opt/oracle/instantclient/libclntsh.so.10.1

libc.so.1 =>/lib/libc.so.1

libnnz10.so =>(file not found)

libkstat.so.1 => /lib/libkstat.so.1

libnsl.so.1 =>/lib/libnsl.so.1

libsocket.so.1 =>/lib/libsocket.so.1

libgen.so.1 =>/lib/libgen.so.1

libdl.so.1 =>/lib/libdl.so.1

libsched.so.1 => /usr/lib/libsched.so.1

libaio.so.1 =>/lib/libaio.so.1

librt.so.1 =>/lib/librt.so.1

libm.so.1 =>/lib/libm.so.1

libmp.so.2 =>/lib/libmp.so.2

libmd5.so.1 =>/lib/libmd5.so.1

libscf.so.1 =>/lib/libscf.so.1

libdoor.so.1 => /lib/libdoor.so.1

libuutil.so.1 => /lib/libuutil.so.1

libm.so.2 =>/lib/libm.so.2

/platform/SUNW,Sun-Fire-V210/lib/libc_psr.so.1

/platform/SUNW,Sun-Fire-V210/lib/libmd5_psr.so.1

On a whim, I tried this, and it worked:

ln -s /opt/oracle/instantclient/libnnz10.so /lib/libnnz10.so

So... anybody want to venture a guess as to why I had to manually create a symbolic link for that library file, even though others in the /opt/oracle/instantclient folder were found without issue?

john.tracya at 2007-7-10 14:31:34 > top of Java-index,Open Source Technologies,OpenSPARC...