How can I set up an Apple Silicon (ARM) native model of Oracle’s InstantClient (OCI8) to be used with MAMP?

[ad_1]

Plainly a proverbial pig has lastly flown!

Oracle has graced us with an Apple Silicon (ARM) binary of their InstantClient (OCI8).

Hooray! Oracle appears to have lastly launched an Apple Silicon (ARM) binary of their InstantClient (OCI8).

It may be discovered right here. Within the case of MAMP, you might want to obtain and set up fundamental shopper in addition to the SDK which may be discovered right here; direct obtain hyperlinks:

So far as putting in in on macOS to be used with MAMP, it’s just about the identical process because the Intel model. These directions are offered beneath for straightforward reference.

Set up MAMP and set it up in your Bash $PATH.

On a most elementary degree, first obtain and set up MAMP right here. These directions are primarily based on putting in MAMP 6.9, so here’s a direct obtain hyperlink for MAMP 6.9 for Apple Silicon right here.

As soon as that’s achieved, edit your .bash_profile file like this; I exploit nano .bash_profile to edit it and add these strains in an applicable place:

# MAMP stuff.
export MAMP_BIN="/Purposes/MAMP/Library/bin";
# export MAMP_PHP="/Purposes/MAMP/bin/php/php7.4.33/bin";
export MAMP_PHP="/Purposes/MAMP/bin/php/php8.2.0/bin";

# Remaining $PATH setting.
# export PATH="/usr/native/bin:/usr/native/sbin:$PATH";
export PATH="/usr/native/bin:/usr/native/sbin:$MAMP_BIN:$MAMP_PHP:$PATH";

Be aware I’ve two entries for export MAMP_PHP since MAMP at all times has two choices for PHP put in. Selecting to make use of PHP 8.2.0 on this instance since it’s more moderen than PHP 7.4.33.

As soon as that’s setup, exit the Terminal after which reopen it and kind which php, the trail to PHP that ought to be returned is:

/Purposes/MAMP/bin/php/php8.2.0/bin/php

Set up the Oracle InstantClient (OCI8).

NOTE: Oracle has some very fundamental set up scripts with their binaries, however I don’t like utilizing them as a result of the set up the InstantClient into your Downloads/ listing; which appears frankly ridiculous. I exploit this methodology as a substitute which I believe is cleaner/saner.

Now, throughout the Terminal, run this command to create a protected vacation spot path for the Oracle InstantClient stuff right here:

sudo mkdir -p /choose/oracle/instantclient/instantclient_23_3

Since that may be a sudo command, it should ask for an administrator’s password. However as soon as that’s achieved, transfer onto the subsequent step.

Mount the 2 DMG recordsdata by double-clicking on them. As soon as they’re mounted, run these two cp instructions:

sudo cp -RPf /Volumes/instantclient-basic-macos.arm64-23.3.0.23.09/* /choose/oracle/instantclient/instantclient_23_3
sudo cp -RPf /Volumes/instantclient-sdk-macos.arm64-23.3.0.23.09/sdk /choose/oracle/instantclient/instantclient_23_3

And the Oracle InstantClient (OCI8) ought to be put in. You possibly can verify by working this command:

ls -la  /choose/oracle/instantclient/instantclient_23_3

If the contents appear like the beneath output, you’re good to go!

whole 551896
drwxr-xr-x@ 49 root  wheel       1568 Aug 13 14:55 .
drwxr-xr-x   3 root  wheel         96 Aug 13 14:49 ..
-r--r--r--@  1 root  wheel       6506 Aug 13 14:54 BASIC_LICENSE
-r--r--r--@  1 root  wheel        455 Aug 13 14:54 BASIC_README
-r-xr-xr-x@  1 root  wheel        548 Aug 13 14:54 INSTALL_IC_README.txt
-r-xr-xr-x@  1 root  wheel     112000 Aug 13 14:54 adrci
-r-xr-xr-x@  1 root  wheel    1335376 Aug 13 14:54 fips.dylib
-r-xr-xr-x@  1 root  wheel     129264 Aug 13 14:54 genezi
-r-xr-xr-x@  1 root  wheel       1072 Aug 13 14:54 install_ic.sh
-r-xr-xr-x@  1 root  wheel    3205968 Aug 13 14:54 legacy.dylib
lrwxr-xr-x@  1 root  wheel         20 Aug 13 14:54 libclntsh.dylib -> libclntsh.dylib.23.1
lrwxr-xr-x@  1 root  wheel         20 Aug 13 14:54 libclntsh.dylib.10.1 -> libclntsh.dylib.23.1
lrwxr-xr-x@  1 root  wheel         20 Aug 13 14:54 libclntsh.dylib.11.1 -> libclntsh.dylib.23.1
lrwxr-xr-x@  1 root  wheel         20 Aug 13 14:54 libclntsh.dylib.12.1 -> libclntsh.dylib.23.1
lrwxr-xr-x@  1 root  wheel         20 Aug 13 14:54 libclntsh.dylib.18.1 -> libclntsh.dylib.23.1
lrwxr-xr-x@  1 root  wheel         20 Aug 13 14:54 libclntsh.dylib.19.1 -> libclntsh.dylib.23.1
lrwxr-xr-x@  1 root  wheel         20 Aug 13 14:54 libclntsh.dylib.20.1 -> libclntsh.dylib.23.1
lrwxr-xr-x@  1 root  wheel         20 Aug 13 14:54 libclntsh.dylib.21.1 -> libclntsh.dylib.23.1
lrwxr-xr-x@  1 root  wheel         20 Aug 13 14:54 libclntsh.dylib.22.1 -> libclntsh.dylib.23.1
-r-xr-xr-x@  1 root  wheel   51248032 Aug 13 14:54 libclntsh.dylib.23.1
lrwxr-xr-x@  1 root  wheel         24 Aug 13 14:54 libclntshcore.dylib -> libclntshcore.dylib.23.1
lrwxr-xr-x@  1 root  wheel         24 Aug 13 14:54 libclntshcore.dylib.12.1 -> libclntshcore.dylib.23.1
lrwxr-xr-x@  1 root  wheel         24 Aug 13 14:54 libclntshcore.dylib.18.1 -> libclntshcore.dylib.23.1
lrwxr-xr-x@  1 root  wheel         24 Aug 13 14:54 libclntshcore.dylib.19.1 -> libclntshcore.dylib.23.1
lrwxr-xr-x@  1 root  wheel         24 Aug 13 14:54 libclntshcore.dylib.20.1 -> libclntshcore.dylib.23.1
lrwxr-xr-x@  1 root  wheel         24 Aug 13 14:54 libclntshcore.dylib.21.1 -> libclntshcore.dylib.23.1
lrwxr-xr-x@  1 root  wheel         24 Aug 13 14:54 libclntshcore.dylib.22.1 -> libclntshcore.dylib.23.1
-r-xr-xr-x@  1 root  wheel    2663552 Aug 13 14:54 libclntshcore.dylib.23.1
-r-xr-xr-x@  1 root  wheel    5577424 Aug 13 14:54 libnnz.dylib
lrwxr-xr-x@  1 root  wheel         18 Aug 13 14:54 libocci.dylib -> libocci.dylib.23.1
lrwxr-xr-x@  1 root  wheel         18 Aug 13 14:54 libocci.dylib.10.1 -> libocci.dylib.23.1
lrwxr-xr-x@  1 root  wheel         18 Aug 13 14:54 libocci.dylib.11.1 -> libocci.dylib.23.1
lrwxr-xr-x@  1 root  wheel         18 Aug 13 14:54 libocci.dylib.12.1 -> libocci.dylib.23.1
lrwxr-xr-x@  1 root  wheel         18 Aug 13 14:54 libocci.dylib.18.1 -> libocci.dylib.23.1
lrwxr-xr-x@  1 root  wheel         18 Aug 13 14:54 libocci.dylib.19.1 -> libocci.dylib.23.1
lrwxr-xr-x@  1 root  wheel         18 Aug 13 14:54 libocci.dylib.20.1 -> libocci.dylib.23.1
lrwxr-xr-x@  1 root  wheel         18 Aug 13 14:54 libocci.dylib.21.1 -> libocci.dylib.23.1
lrwxr-xr-x@  1 root  wheel         18 Aug 13 14:54 libocci.dylib.22.1 -> libocci.dylib.23.1
-r-xr-xr-x@  1 root  wheel     793232 Aug 13 14:54 libocci.dylib.23.1
-r-xr-xr-x@  1 root  wheel  198179664 Aug 13 14:54 libociei.dylib
-r-xr-xr-x@  1 root  wheel     235344 Aug 13 14:54 libocijdbc23.dylib
drwxr-xr-x@  3 root  wheel         96 Aug 13 14:54 community
-r--r--r--@  1 root  wheel    7105082 Aug 13 14:54 ojdbc11.jar
-r--r--r--@  1 root  wheel    6977779 Aug 13 14:54 ojdbc8.jar
-r-xr-xr-x@  1 root  wheel    3240448 Aug 13 14:54 pkcs11.dylib
drwxr-xr-x@  7 root  wheel        224 Aug 13 14:55 sdk
-r--r--r--@  1 root  wheel    1483267 Aug 13 14:54 ucp.jar
-r-xr-xr-x@  1 root  wheel     197728 Aug 13 14:54 uidrvci
-r--r--r--@  1 root  wheel      32663 Aug 13 14:54 xstreams.jar

Compiling and putting in the Oracle InstantClient (OCI8) module for PHP.

Okay, with MAMP put in and the Oracle InstantClient (OCI8) put in, we now transfer onto really compiling the oci8.so module for PHP.

Run this command:

pecl set up oci8

And dangle on whereas the oci8.so module compiles!

Throughout the set up you is likely to be requested to offer the ORACLE_HOME path through a message like this:

Please present the trail to the ORACLE_HOME listing. Use
'instantclient,/path/to/immediate/shopper/lib' in case you're compiling with Oracle Instantaneous Shopper [autodetect] :

We’re not completely setting ORACLE_HOME, so simply use this as the trail:

instantclient,/choose/oracle/instantclient/instantclient_23_3

After PECL does its factor, the oci8.so ought to be compiled and able to go.

Putting in the InstantClient (OCI8) module in PHP.

Now regulate the PHP config file (php.ini) like this to get PHP to acknowledge it. Open up the php.ini like this:

nano /Purposes/MAMP/bin/php/php8.2.0/conf/php.ini

And add these items to the underside of the file:

[OCI8]
extension=oci8.so

Now begin MAMP once more and examine the output of the PHP information web page (http://localhost:8888/MAMP/phpinfo.php) and OCI8 ought to now be clearly listed there beneath put in elements; screenshot beneath:
PHP info in MAMP showing OCI8 3.4.0 is installed.

[ad_2]

Leave a Reply

Your email address will not be published. Required fields are marked *