Installing PHP OCI8 Extension on Mac OSX(10.11.6)

  1. Installed or Verified that Homebrew is installed on your Mac. If hasn’t installed yet, open terminal and paste command which is written on the actual Homebrew website
  2. Install the PEAR package manager to run PECL.
  3. Download these files from Oracle website

  4. Create and unzip all theses files into a the directory `/usr/local/instantclient/12_1/`.
    This directory will looks like:
  5. Create Symbolic link

    ln -s /usr/local/instantclient/12_1/sdk/include/*.h /usr/local/include/
    ln -s /usr/local/instantclient/12_1/sqlplus /usr/local/bin/
    ln -s /usr/local/instantclient/12_1/*.dylib /usr/local/lib/
    ln -s /usr/local/instantclient/12_1/*.dylib.11.1 /usr/local/lib/
    ln -s /usr/local/lib/libclntsh.dylib.11.1 /usr/local/lib/libclntsh.dylib

  6. Test with sqlplus instantclientsqlplus username/
  7. Install extension with pecl
  8. If the script prompt you to provide the path to ORACLE_HOME directory, respond with:/usr/local/instantclient/12_1
    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`:
  9. Restart your HTTP Server and test.
  10. Enjoy

Below links for more reference:

About the Author