Question

I need to use the OCI8 module for PHP on Mountain Lion which will use the oracle instant client, which is currently only supported as 32 bit.

I have installed the 32bit version of the oracle instant client and tested it with sqlplus and all seems well.

Now however I need to get the PHP extension OCI8 working, which has led me to build a 32 bit PHP module for apache with homebrew. Again this seems to be working but as I understand it this will now require a 32 bit build of Apache, the built-in version seems to be 64 bit only. I can't work out how to build Apache as 32 bit and I'm not even certain this is required so am at somewhat of a loss. Any help much appreciated Alastair

EDIT:

For now I have abandoned a native install in favour of virtualised development using Vagrant and Ubuntu: https://github.com/afhole/vagrant-lamp

Was it helpful?

Solution

Go there : http://www.oracle.com/technetwork/topics/intel-macsoft-096467.html

Use the Version 11.2.0.3.0 (64-bit) of the files.

EDIT: In the instructions provided below, change the line :

sudo ln -s libclntsh.dylib.10.1 libclntsh.dylib

to

sudo ln -s libclntsh.dylib.11.1 libclntsh.dylib

Installation instructions are here : http://www.enavigo.com/2012/01/04/enabling-oracle-oci8-php-extension-on-os-x-snow-leopard/

It works on my Macbook Air under 10.8.2

OTHER TIPS

I am trying to do the same, and the answers in this thread seem to work:

Force Apache HTTPD to run in 32bit

E.g. you could run

(sudo) arch -i386 apachectl start
(sudo) arch -i386 apachectl stop
(sudo) arch -i386 apachectl restart

to force Apache to run in 32-bit mode.

If you always want to run in 32-bit mode you could add the arch command to a new <string> in <key>ProgramArguments</key> array in /System/Library/LaunchDaemons/org.apache.httpd.plist.

After much research I found a sustainable solution to configuring Apache with PHP and OCI8 on OS X. You can install the Oracle Instant Client libraries anywhere, and then all you need to do is edit Apache's launchd configuration .plist file to specify the required DYLD_LIBRARY_PATH, ORACLE_HOME, and LD_LIBRARY_PATH environment variables so that PHP can actually see them (it won't see these environment variables from your ~/.bash_profile when PHP is running as an Apache module).

I have also had success getting OCI8 to work under the 64-bit version of Apache and PHP on OS X 10.7.4 and OS X 10.8.4. I originally combined the 32- and 64-bit versions of the Oracle Instant Client libraries into multi-architecture fat-binaries. This allowed the same Oracle Instant Client libraries to be used on my system by different tools, some of which where running in 32-bit mode and others which ran as 64-bit. On OS X 10.8 you should be successful using the more recently released 64-bit versions of the Oracle Instant Client libraries, without having to resort to running Apache in 32-bit mode. I will try to write up what I did when I have more time, as it may also be helpful to others.

You can view the full answer about configuring Apache 'process specific' environment variables here: https://stackoverflow.com/a/20670810/1914455

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top