Wednesday, March 13, 2013

mampstack-5.3.22-0 and OCI8 Oracle on OSX 10.7.5

Installed mampstack-5.3.22-0 from bitnami.org, all defaults.... (NOTE: I tried MAMP/MAMP-PRO first and this product was not agile enough to install the OCI8 module, so stay away, unless you like to puzzle your way thru the installation)

Installed Oracle's instantclient for MacOSX x86_64 editions on oracles download site (login required)

  • instantclient-sdk-macos.x64-11.2.0.3.0.zip
  • instantclient-sqlplus-macos.x64-11.2.0.3.0.zip
  • instantclient-basic-macos.x64-11.2.0.3.0.zip
  • instantclient-tools-macos.x64-11.2.0.3.0.zip

Installation InstantClient Oracle on x86_64

Unpack all downloaded package (located in my case under ~/Downloads)
$ mkdir -p /System/Library/Oracle/
$ cd /System/Library/Oracle/
$ unzip ~/Downloads/instantclient*.zip .
Next linking all of the libraries to the general area.
$ cd /usr/lib
$ ls  /System/Library/Oracle/instantclient_11_2/*.dylib | xargs -I% -t ln -s % .
ln -s /System/Library/Oracle/instantclient_11_2/libnnz11.dylib .
ln -s /System/Library/Oracle/instantclient_11_2/libociei.dylib .
ln -s /System/Library/Oracle/instantclient_11_2/libocijdbc11.dylib .
ln -s /System/Library/Oracle/instantclient_11_2/libsqlplus.dylib .
ln -s /System/Library/Oracle/instantclient_11_2/libsqlplusic.dylib .
The result symlinked the libraries
$ ls -lrt
total 40
lrwxr-xr-x  1 akaan  wheel  60 Mar 13 13:15 libsqlplusic.dylib -> /System/Library/Oracle/instantclient_11_2/libsqlplusic.dylib
lrwxr-xr-x  1 akaan  wheel  58 Mar 13 13:15 libsqlplus.dylib -> /System/Library/Oracle/instantclient_11_2/libsqlplus.dylib
lrwxr-xr-x  1 akaan  wheel  60 Mar 13 13:15 libocijdbc11.dylib -> /System/Library/Oracle/instantclient_11_2/libocijdbc11.dylib
lrwxr-xr-x  1 akaan  wheel  56 Mar 13 13:15 libociei.dylib -> /System/Library/Oracle/instantclient_11_2/libociei.dylib
lrwxr-xr-x  1 akaan  wheel  56 Mar 13 13:15 libnnz11.dylib -> /System/Library/Oracle/instantclient_11_2/libnnz11.dylib
Follow the same process for other items
$ cd /usr/lib
$ sudo ls  /System/Library/Oracle/instantclient_11_2/*.dylib.* | xargs -I% -t ln -s % .
Next linking the include header files.
$ cd /usr/include
$ sudo ls  /System/Library/Oracle/instantclient_11_2/sdk/include/*.h | xargs -I% -t ln -s % .
Next linking sqlplus
$ cd /usr/bin
$ sudo ln -s /System/Library/Oracle/instantclient_11_2/sqlplus .
And last relink the versioned cntl file
$ cd /usr/lib
$ sudo ln -s libclntsh.dylib.11.1 libclntsh.dylib

Installation oci8 module on mampstack-5.3.22-0

Next tying in the oci8 module for PHP connectivity... First validate that sqlplus works otherwise you waste time with a broken instant client installation.
MacBook-Pro:~ johnsmith$ sqlplus
SQL*Plus: Release 11.2.0.3.0 Production on Wed Mar 13 14:15:59 2013
Copyright (c) 1982, 2012, Oracle.  All rights reserved.
Enter user-name: 
Next move to the mampstack installation directory under the php area and install the oci8 package, when prompted for the installation of the instantclient use instantclient,/usr/lib
MacBook-Pro:bin johnsmith$ cd /Applications/mampstack-5.3.22-0
MacBook-Pro:mampstack-5.3.22-0 johnsmith$ cd ./php/bin
MacBook-Pro:bin johnsmith$ ./pecl install oci8
downloading oci8-1.4.9.tgz ...
Starting to download oci8-1.4.9.tgz (169,255 bytes)
.....................................done: 169,255 bytes
10 source files, building
WARNING: php_bin /Applications/mampstack-5.3.22-0/php/bin/php appears to have a suffix /bin/php, but config variable php_suffix does not match
running: phpize
Configuring for:
PHP Api Version:         20090626
Zend Module Api No:      20090626
Zend Extension Api No:   220090626
Can't load '/Applications/mampstack-5.3.22-0/perl/lib/5.8.8/darwin-2level/auto/Data/Dumper/Dumper.bundle' for module Data::Dumper: dlopen(/Applications/mampstack-5.3.22-0/perl/lib/5.8.8/darwin-2level/auto/Data/Dumper/Dumper.bundle, 1): Symbol not found: _PL_compiling
  Referenced from: /Applications/mampstack-5.3.22-0/perl/lib/5.8.8/darwin-2level/auto/Data/Dumper/Dumper.bundle
  Expected in: dynamic lookup
 at /Applications/mampstack-5.3.22-0/perl/lib/5.8.8/darwin-2level/Data/Dumper.pm line 36
Compilation failed in require at /usr/bin/../share/autoconf/Autom4te/C4che.pm line 35.
BEGIN failed--compilation aborted at /usr/bin/../share/autoconf/Autom4te/C4che.pm line 35.
Compilation failed in require at /usr/bin/autom4te line 43.
BEGIN failed--compilation aborted at /usr/bin/autom4te line 43.
ERROR: `phpize' failed
MacBook-Pro:bin johnsmith$ 

OCI8 - MAMPstack-5.3.22-0 - Perl Issues

To resolve this error and end up using the default perl version (in 10.7.5 installation that I have its 5.12.x)
MacBook-Pro:bin$ perl -v
This is perl 5, version 12, subversion 3 (v5.12.3) built for darwin-thread-multi-2level
(with 2 registered patches, see perl -V for more detail)
Copyright 1987-2010, Larry Wall
Comment out the PERL5LIB definition in /Applications/mampstack-5.3.22-0/scripts/setenv.sh like this:
.....
##### PERL ENV #####
#PERL5LIB="/Applications/mampstack-5.3.22-0/perl/lib/5.8.8:/Applications/mampstack-5.3.22-0/perl/lib/site_perl/5.8.8:/Applications/mampstack-5.3.22-0/perl/lib/5.8.8/darwin-2level:/Applications/mampstack-5.3.22-0/perl/lib/site_perl/5.8.8/darwin-2level"
#export PERL5LIB
LC_ALL=en_US
export LC_ALL
.....
Close your terminal and startup a new one (flushing the environment); and retry the new settings....
MacBook-Pro:bin johnsmith$ cd /Applications/mampstack-5.3.22-0
MacBook-Pro:mampstack-5.3.22-0 johnsmith$ cd ./php/bin
MacBook-Pro:bin johnsmith$ ./pecl install oci8
downloading oci8-1.4.9.tgz ...
Starting to download oci8-1.4.9.tgz (169,255 bytes)
.....................................done: 169,255 bytes
10 source files, building
WARNING: php_bin /Applications/mampstack-5.3.22-0/php/bin/php appears to have a suffix /bin/php, but config variable php_suffix does not match
running: phpize
Configuring for:
PHP Api Version:         20090626
Zend Module Api No:      20090626
Zend Extension Api No:   220090626
Please provide the path to the ORACLE_HOME directory. Use 'instantclient,/path/to/instant/client/lib' if you're compiling with Oracle Instant Client [autodetect] : instantclient,/usr/lib
building in /private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9
running: /private/tmp/pear/temp/oci8/configure --with-oci8=instantclient,/usr/lib
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking for cc... cc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... i386-apple-darwin11.4.2
checking host system type... i386-apple-darwin11.4.2
checking target system type... i386-apple-darwin11.4.2
checking for PHP prefix... /Applications/mampstack-5.3.22-0/php
checking for PHP includes... -I/Applications/mampstack-5.3.22-0/php/include/php -I/Applications/mampstack-5.3.22-0/php/include/php/main -I/Applications/mampstack-5.3.22-0/php/include/php/TSRM -I/Applications/mampstack-5.3.22-0/php/include/php/Zend -I/Applications/mampstack-5.3.22-0/php/include/php/ext -I/Applications/mampstack-5.3.22-0/php/include/php/ext/date/lib
checking for PHP extension directory... /Applications/mampstack-5.3.22-0/php/lib/php/extensions
checking for PHP installed headers prefix... /Applications/mampstack-5.3.22-0/php/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... no
checking for nawk... no
checking for awk... awk
checking if awk is broken... no
checking for Oracle Database OCI8 support... yes, shared
checking PHP version... 5.3.22, ok
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for long int... yes
checking size of long int... 8
checking checking if we're on a 64-bit platform... yes
checking Oracle Instant Client directory... /usr/lib
checking Oracle Instant Client SDK header directory... /usr/include
checking Oracle Instant Client library version compatibility... 11.1
checking for ld used by cc... /usr/llvm-gcc-4.2/libexec/gcc/i686-apple-darwin11/4.2.1/ld
checking if the linker (/usr/llvm-gcc-4.2/libexec/gcc/i686-apple-darwin11/4.2.1/ld) is GNU ld... no
checking for /usr/llvm-gcc-4.2/libexec/gcc/i686-apple-darwin11/4.2.1/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking the maximum length of command line arguments... 196608
checking command to parse /usr/bin/nm output from cc object... rm: conftest.dSYM: is a directory
ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking for dsymutil... dsymutil
checking for nmedit... nmedit
checking for -single_module linker flag... yes
checking for -exported_symbols_list linker flag... yes
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fno-common
checking if cc PIC flag -fno-common works... yes
checking if cc static flag -static works... no
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/usr/llvm-gcc-4.2/libexec/gcc/i686-apple-darwin11/4.2.1/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin11.4.2 dyld
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no

creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h
running: make
/bin/sh /private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/libtool --mode=compile cc  -I. -I/private/tmp/pear/temp/oci8 -DPHP_ATOM_INC -I/private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/include -I/private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/main -I/private/tmp/pear/temp/oci8 -I/Applications/mampstack-5.3.22-0/php/include/php -I/Applications/mampstack-5.3.22-0/php/include/php/main -I/Applications/mampstack-5.3.22-0/php/include/php/TSRM -I/Applications/mampstack-5.3.22-0/php/include/php/Zend -I/Applications/mampstack-5.3.22-0/php/include/php/ext -I/Applications/mampstack-5.3.22-0/php/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /private/tmp/pear/temp/oci8/oci8.c -o oci8.lo
mkdir .libs
 cc -I. -I/private/tmp/pear/temp/oci8 -DPHP_ATOM_INC -I/private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/include -I/private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/main -I/private/tmp/pear/temp/oci8 -I/Applications/mampstack-5.3.22-0/php/include/php -I/Applications/mampstack-5.3.22-0/php/include/php/main -I/Applications/mampstack-5.3.22-0/php/include/php/TSRM -I/Applications/mampstack-5.3.22-0/php/include/php/Zend -I/Applications/mampstack-5.3.22-0/php/include/php/ext -I/Applications/mampstack-5.3.22-0/php/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /private/tmp/pear/temp/oci8/oci8.c  -fno-common -DPIC -o .libs/oci8.o
/bin/sh /private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/libtool --mode=compile cc  -I. -I/private/tmp/pear/temp/oci8 -DPHP_ATOM_INC -I/private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/include -I/private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/main -I/private/tmp/pear/temp/oci8 -I/Applications/mampstack-5.3.22-0/php/include/php -I/Applications/mampstack-5.3.22-0/php/include/php/main -I/Applications/mampstack-5.3.22-0/php/include/php/TSRM -I/Applications/mampstack-5.3.22-0/php/include/php/Zend -I/Applications/mampstack-5.3.22-0/php/include/php/ext -I/Applications/mampstack-5.3.22-0/php/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /private/tmp/pear/temp/oci8/oci8_lob.c -o oci8_lob.lo
 cc -I. -I/private/tmp/pear/temp/oci8 -DPHP_ATOM_INC -I/private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/include -I/private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/main -I/private/tmp/pear/temp/oci8 -I/Applications/mampstack-5.3.22-0/php/include/php -I/Applications/mampstack-5.3.22-0/php/include/php/main -I/Applications/mampstack-5.3.22-0/php/include/php/TSRM -I/Applications/mampstack-5.3.22-0/php/include/php/Zend -I/Applications/mampstack-5.3.22-0/php/include/php/ext -I/Applications/mampstack-5.3.22-0/php/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /private/tmp/pear/temp/oci8/oci8_lob.c  -fno-common -DPIC -o .libs/oci8_lob.o
/bin/sh /private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/libtool --mode=compile cc  -I. -I/private/tmp/pear/temp/oci8 -DPHP_ATOM_INC -I/private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/include -I/private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/main -I/private/tmp/pear/temp/oci8 -I/Applications/mampstack-5.3.22-0/php/include/php -I/Applications/mampstack-5.3.22-0/php/include/php/main -I/Applications/mampstack-5.3.22-0/php/include/php/TSRM -I/Applications/mampstack-5.3.22-0/php/include/php/Zend -I/Applications/mampstack-5.3.22-0/php/include/php/ext -I/Applications/mampstack-5.3.22-0/php/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /private/tmp/pear/temp/oci8/oci8_statement.c -o oci8_statement.lo
 cc -I. -I/private/tmp/pear/temp/oci8 -DPHP_ATOM_INC -I/private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/include -I/private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/main -I/private/tmp/pear/temp/oci8 -I/Applications/mampstack-5.3.22-0/php/include/php -I/Applications/mampstack-5.3.22-0/php/include/php/main -I/Applications/mampstack-5.3.22-0/php/include/php/TSRM -I/Applications/mampstack-5.3.22-0/php/include/php/Zend -I/Applications/mampstack-5.3.22-0/php/include/php/ext -I/Applications/mampstack-5.3.22-0/php/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /private/tmp/pear/temp/oci8/oci8_statement.c  -fno-common -DPIC -o .libs/oci8_statement.o
/bin/sh /private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/libtool --mode=compile cc  -I. -I/private/tmp/pear/temp/oci8 -DPHP_ATOM_INC -I/private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/include -I/private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/main -I/private/tmp/pear/temp/oci8 -I/Applications/mampstack-5.3.22-0/php/include/php -I/Applications/mampstack-5.3.22-0/php/include/php/main -I/Applications/mampstack-5.3.22-0/php/include/php/TSRM -I/Applications/mampstack-5.3.22-0/php/include/php/Zend -I/Applications/mampstack-5.3.22-0/php/include/php/ext -I/Applications/mampstack-5.3.22-0/php/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /private/tmp/pear/temp/oci8/oci8_collection.c -o oci8_collection.lo
 cc -I. -I/private/tmp/pear/temp/oci8 -DPHP_ATOM_INC -I/private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/include -I/private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/main -I/private/tmp/pear/temp/oci8 -I/Applications/mampstack-5.3.22-0/php/include/php -I/Applications/mampstack-5.3.22-0/php/include/php/main -I/Applications/mampstack-5.3.22-0/php/include/php/TSRM -I/Applications/mampstack-5.3.22-0/php/include/php/Zend -I/Applications/mampstack-5.3.22-0/php/include/php/ext -I/Applications/mampstack-5.3.22-0/php/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /private/tmp/pear/temp/oci8/oci8_collection.c  -fno-common -DPIC -o .libs/oci8_collection.o
/bin/sh /private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/libtool --mode=compile cc  -I. -I/private/tmp/pear/temp/oci8 -DPHP_ATOM_INC -I/private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/include -I/private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/main -I/private/tmp/pear/temp/oci8 -I/Applications/mampstack-5.3.22-0/php/include/php -I/Applications/mampstack-5.3.22-0/php/include/php/main -I/Applications/mampstack-5.3.22-0/php/include/php/TSRM -I/Applications/mampstack-5.3.22-0/php/include/php/Zend -I/Applications/mampstack-5.3.22-0/php/include/php/ext -I/Applications/mampstack-5.3.22-0/php/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -c /private/tmp/pear/temp/oci8/oci8_interface.c -o oci8_interface.lo
 cc -I. -I/private/tmp/pear/temp/oci8 -DPHP_ATOM_INC -I/private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/include -I/private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/main -I/private/tmp/pear/temp/oci8 -I/Applications/mampstack-5.3.22-0/php/include/php -I/Applications/mampstack-5.3.22-0/php/include/php/main -I/Applications/mampstack-5.3.22-0/php/include/php/TSRM -I/Applications/mampstack-5.3.22-0/php/include/php/Zend -I/Applications/mampstack-5.3.22-0/php/include/php/ext -I/Applications/mampstack-5.3.22-0/php/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /private/tmp/pear/temp/oci8/oci8_interface.c  -fno-common -DPIC -o .libs/oci8_interface.o
/bin/sh /private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/libtool --mode=link cc -DPHP_ATOM_INC -I/private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/include -I/private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/main -I/private/tmp/pear/temp/oci8 -I/Applications/mampstack-5.3.22-0/php/include/php -I/Applications/mampstack-5.3.22-0/php/include/php/main -I/Applications/mampstack-5.3.22-0/php/include/php/TSRM -I/Applications/mampstack-5.3.22-0/php/include/php/Zend -I/Applications/mampstack-5.3.22-0/php/include/php/ext -I/Applications/mampstack-5.3.22-0/php/include/php/ext/date/lib  -DHAVE_CONFIG_H  -g -O2   -o oci8.la -export-dynamic -avoid-version -prefer-pic -module -rpath /private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/modules  oci8.lo oci8_lob.lo oci8_statement.lo oci8_collection.lo oci8_interface.lo -lclntsh
cc ${wl}-flat_namespace ${wl}-undefined ${wl}suppress -o .libs/oci8.so -bundle  .libs/oci8.o .libs/oci8_lob.o .libs/oci8_statement.o .libs/oci8_collection.o .libs/oci8_interface.o  -lclntsh
dsymutil .libs/oci8.so || :
creating oci8.la
(cd .libs && rm -f oci8.la && ln -s ../oci8.la oci8.la)
/bin/sh /private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/libtool --mode=install cp ./oci8.la /private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/modules
cp ./.libs/oci8.so /private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/modules/oci8.so
cp ./.libs/oci8.lai /private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/modules/oci8.la
----------------------------------------------------------------------
Libraries have been installed in:
   /private/tmp/pear/temp/pear-build-johnsmithUbHMFa/oci8-1.4.9/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 `DYLD_LIBRARY_PATH' environment variable
     during execution

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------

Build complete.
Don't forget to run 'make test'.

running: make INSTALL_ROOT="/private/tmp/pear/temp/pear-build-johnsmithUbHMFa/install-oci8-1.4.9" install
Installing shared extensions:     /private/tmp/pear/temp/pear-build-johnsmithUbHMFa/install-oci8-1.4.9/Applications/mampstack-5.3.22-0/php/lib/php/extensions/
running: find "/private/tmp/pear/temp/pear-build-johnsmithUbHMFa/install-oci8-1.4.9" | xargs ls -dils
20501804   0 drwxr-xr-x  3 johnsmith  wheel     102 Mar 13 12:40 /private/tmp/pear/temp/pear-build-johnsmithUbHMFa/install-oci8-1.4.9
20502308   0 drwxr-xr-x  3 johnsmith  wheel     102 Mar 13 12:40 /private/tmp/pear/temp/pear-build-johnsmithUbHMFa/install-oci8-1.4.9/Applications
20502309   0 drwxr-xr-x  3 johnsmith  wheel     102 Mar 13 12:40 /private/tmp/pear/temp/pear-build-johnsmithUbHMFa/install-oci8-1.4.9/Applications/mampstack-5.3.22-0
20502310   0 drwxr-xr-x  3 johnsmith  wheel     102 Mar 13 12:40 /private/tmp/pear/temp/pear-build-johnsmithUbHMFa/install-oci8-1.4.9/Applications/mampstack-5.3.22-0/php
20502311   0 drwxr-xr-x  3 johnsmith  wheel     102 Mar 13 12:40 /private/tmp/pear/temp/pear-build-johnsmithUbHMFa/install-oci8-1.4.9/Applications/mampstack-5.3.22-0/php/lib
20502312   0 drwxr-xr-x  3 johnsmith  wheel     102 Mar 13 12:40 /private/tmp/pear/temp/pear-build-johnsmithUbHMFa/install-oci8-1.4.9/Applications/mampstack-5.3.22-0/php/lib/php
20502313   0 drwxr-xr-x  3 johnsmith  wheel     102 Mar 13 12:40 /private/tmp/pear/temp/pear-build-johnsmithUbHMFa/install-oci8-1.4.9/Applications/mampstack-5.3.22-0/php/lib/php/extensions
20502314 384 -rwxr-xr-x  1 johnsmith  wheel  194492 Mar 13 12:40 /private/tmp/pear/temp/pear-build-johnsmithUbHMFa/install-oci8-1.4.9/Applications/mampstack-5.3.22-0/php/lib/php/extensions/oci8.so

Build process completed successfully
Installing '/Applications/mampstack-5.3.22-0/php/lib/php/extensions/oci8.so'
install ok: channel://pecl.php.net/oci8-1.4.9
configuration option "php_ini" is not set to php.ini location
You should add "extension=oci8.so" to php.ini
MacBook-Pro:bin johnsmith$ 

Altering PHP.ini

If you see messages like this one in your /Applications/mampstack-5.3.22-0/apache2/logs/error_log, it means that your oci8 shared object cannot be loaded by the Apache instance;
[Wed Mar 13 14:02:52 2013] [warn] RSA server certificate CommonName (CN) `signings-macbook-pro.local' does NOT match server name!?
PHP Warning:  PHP Startup: Unable to load dynamic library '/Applications/mampstack-5.3.22-0/php/lib/php/extensions/oci8' - dlopen(/Applications/mampstack-5.3.22-0/php/lib/php/extensions/oci8, 9): image not found in Unknown on line 0
Do the following
MacBook-Pro:etc johnsmith$ cd /Applications/mampstack-5.3.22-0/php/etc
MacBook-Pro:etc johnsmith$ vi php.ini 
add oci8 extension
.....
; Local Variables:
; tab-width: 4
; End:
;extension=oauth.so
;extension=memcache.so
;extension=uploadprogress.so
extension=apc.so
extension=oci8.so
.....
MacBook-Pro:etc johnsmith$ chmod 755 /Applications/mampstack-5.3.22-0/php/lib/php/extensions/oci8.so
Make sure that the extension is defined at the proper section otherwise it will not load correctly with the same image not found message in the error log (/Applications/mampstack-5.3.22-0/apache2/logs/error_log).

My First Oracle Test OCI8-PHP-MAMP

First the connect string; if you have trouble with the connect string try the tnsping utility (unfortunately not part of the instantclient).
$ tnsping PMI_SVC1_DEV
TNS Ping Utility for Linux: Version 10.2.0.4.0 - Production on 13-MAR-2013 18:26:22
Copyright (c) 1997,  2007, Oracle.  All rights reserved.
Used parameter files:
/opt/oracle/product/10.2.0.4/network/admin/sqlnet.ora
Used LDAP adapter to resolve the alias
Attempting to contact (DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=[hostname])(PORT=[listener-port])))(CONNECT_DATA=(SERVICE_NAME=[servicename])(SRVR=DEDICATED)))
OK (0 msec)
Finally here an oracle.php file that can be dropped in the /Application//mampstack-5.3.22-0/apache2/htdocs directory. Open a browser and test the integration

2 comments:

  1. When I run the following command:
    sudo ls /System/Library/Oracle/instantclient_11_2/*.dylib | xargs -I% -t ln -s % .

    I get this:

    ln -s /System/Library/Oracle/instantclient_11_2/libnnz11.dylib .
    ln: ./libnnz11.dylib: Permission denied
    ln -s /System/Library/Oracle/instantclient_11_2/libociei.dylib .
    ln: ./libociei.dylib: Permission denied
    ln -s /System/Library/Oracle/instantclient_11_2/libocijdbc11.dylib .
    ln: ./libocijdbc11.dylib: Permission denied
    ln -s /System/Library/Oracle/instantclient_11_2/libsqlplus.dylib .
    ln: ./libsqlplus.dylib: Permission denied
    ln -s /System/Library/Oracle/instantclient_11_2/libsqlplusic.dylib .
    ln: ./libsqlplusic.dylib: Permission denied

    What Im doing wrong?

    ReplyDelete
    Replies
    1. might want to put the command for sudo between single quotes. Like
      sudo ''

      Delete