This procedure is tested on Mac OS X 10.12.5 with Developpers tools installed (xCode).
PHP 7.1 installed with Homebrew.
Download the following files from Oracle website (yes, you need to create an account and accept terms):
- instantclient-basic-macos.x64-12.2.0.1.0.zip
- instantclient-sqlplus-macos.x64-12.2.0.1.0.zip
- instantclient-sdk-macos.x64-12.2.0.1.0.zip
Create and unzip all theses files into a the directory /usr/local/instantclient/12.2.0.1.0/
.
This directory will looks like:
.
├── BASIC_README
├── SQLPLUS_README
├── adrci
├── genezi
├── glogin.sql
├── libclntsh.dylib.12.1
├── libnnz11.dylib
├── libocci.dylib.12.1
├── libociei.dylib
├── libocijdbc11.dylib
├── libsqlplus.dylib
├── libsqlplusic.dylib
├── ojdbc5.jar
├── ojdbc6.jar
├── sdk
│ ├── SDK_README
│ ├── demo
│ ├── include
│ ├── ott
│ └── ottclasses.zip
├── sqlplus
├── uidrvci
└── xstreams.jar
ln -s /usr/local/instantclient/12.2.0.1.0/sdk/include/*.h /usr/local/include/
ln -s /usr/local/instantclient/12.2.0.1.0/sqlplus /usr/local/bin/
ln -s /usr/local/instantclient/12.2.0.1.0/*.dylib /usr/local/lib/
ln -s /usr/local/instantclient/12.2.0.1.0/*.dylib.12.1 /usr/local/lib/
ln -s /usr/local/lib/libclntsh.dylib.12.1 /usr/local/lib/libclntsh.dylib
I recommand to install Oracle Server with a VirtualBox VM preinstalled.
/usr/local/bin/sqlplus oracle/[email protected]
pecl install oci8
If the script prompt you to provide the path to ORACLE_HOME directory, respond with:
instantclient,/usr/local/lib
And your are done, normally pecl will automatically load the extension in your php.ini
. If not, add the following line to your php.ini
:
extension=oci8.so
Restart your HTTP Server and test.
Enjoy (or try to...) !