# How to install OCI8 on macOS 10.15 (Catalina) with PHP 7.3 or 7.4 ## Requirements - [Homebrew](https://brew.sh) - Command Line Tools for Xcode - PHP 7.3 or 7.4 via Homebrew ## Preparation Create a folder to store Oracle Instant Client files. ```bash sudo mkdir /opt/oracle ``` ## Download Oracle Instant Client Download the following files from [Oracle website](https://www.oracle.com/database/technologies/instant-client/macos-intel-x86-downloads.html) - [Basic Package (ZIP)](https://download.oracle.com/otn_software/mac/instantclient/198000/instantclient-basic-macos.x64-19.8.0.0.0dbru.zip) - [SDK Package (ZIP)](https://download.oracle.com/otn_software/mac/instantclient/198000/instantclient-sdk-macos.x64-19.8.0.0.0dbru.zip) Unzip all theses files into a the directory `/opt/oracle/instantclient_19_8`. ## Create symlinks ```bash ln -s /opt/oracle/instantclient_19_8/sdk/include/*.h /usr/local/include/ ln -s /opt/oracle/instantclient_19_8/*.dylib /usr/local/lib/ ln -s /opt/oracle/instantclient_19_8/*.dylib.19.1 /usr/local/lib/ ln -s /usr/local/lib/libclntsh.dylib.19.1 /usr/local/lib/libclntsh.dylib ``` ## Install extension with PECL ```bash pecl install oci8 ``` If the script prompt you to provide the path to ORACLE_HOME directory, respond with: ```bash instantclient,/opt/oracle/instantclient_19_8 ``` **Note:** If you ever got error `command not found: pecl`, make sure PHP bin folder is included in your environment path. ## Test it out Create a file containing the following codes. ```php if (function_exists('oci_connect')) { echo 'OCI8 is working!'; } else { echo 'Whoopss...not working!'; } ``` Restart your HTTP Server and test. ## References - [macosx-install-php-oracle-oci8.md](https://gist.github.com/gido/5237100)