# Installation
This procedure is tested on Mac OS X 10.12.6
PHP 7.2 installed with Homebrew.
## Preparation
Download the following files from [Oracle website](http://www.oracle.com/technetwork/topics/intel-macsoft-096467.html) (yes, you need to create an account and accept terms):
* [instantclient-basic-macos.x64-12.2.0.1.0-2.zip](http://www.oracle.com/technetwork/topics/intel-macsoft-096467.html)
* [instantclient-sqlplus-macos.x64-12.2.0.1.0-2.zip](http://www.oracle.com/technetwork/topics/intel-macsoft-096467.html)
* [instantclient-sdk-macos.x64-12.2.0.1.0-2.zip](http://www.oracle.com/technetwork/topics/intel-macsoft-096467.html)
Create and unzip all theses files into a the directory `/usr/local/instantclient/12.2.0.1/`.
## Create symlinks
```bash
sudo ln -s /usr/local/instantclient/12.2.0.1/sdk/include/*.h /usr/local/include/
sudo ln -s /usr/local/instantclient/12.2.0.1/sqlplus /usr/local/bin/
sudo ln -s /usr/local/instantclient/12.2.0.1/*.dylib /usr/local/lib/
sudo ln -s /usr/local/instantclient/12.2.0.1/*.dylib.12.1 /usr/local/lib/
sudo ln -s /usr/local/lib/libclntsh.dylib.12.1 /usr/local/lib/libclntsh.dylib
```
## Install extension with pecl
```
pecl install oci8
```
On success installation, you will have messages like the following:
```
Build process completed successfully
Installing '/usr/local/Cellar/php/7.2.7/pecl/20170718/oci8.so'
install ok: channel://pecl.php.net/oci8-2.1.8
Extension oci8 enabled in php.ini
```
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`:
> Run `php --ini` to check your `php.ini` file location.
```
extension=oci8.so
```
Then do test the setup by running `php -v`.
If you are having error code like the following:
```
Warning: PHP Startup: Unable to load dynamic library 'oci8.so' (tried: /usr/local/Cellar/php/7.2.7/lib/php/20170718/oci8.so (dlopen(/usr/local/Cellar/php/7.2.7/lib/php/20170718/oci8.so, 9): image not found), /usr/local/Cellar/php/7.2.7/lib/php/20170718/oci8.so.so (dlopen(/usr/local/Cellar/php/7.2.7/lib/php/20170718/oci8.so.so, 9): image not found)) in Unknown on line 0
```
You can copy the `oci8.so` generated to the target path. In above case as following:
```
cp /usr/local/Cellar/php/7.2.7/pecl/20170718/oci8.so /usr/local/Cellar/php/7.2.7/lib/php/20170718/
```
Then you should see no more error message when runninng `php -v`.
Restart your HTTP Server and test.
Enjoy (or try to...) !