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

    instantclient-basic-macos.x64-11.2.0.3.0.zip
    instantclient-sqlplus-macos.x64-11.2.0.3.0.zip
    instantclient-sdk-macos.x64-11.2.0.3.0.zip

  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/password@xfwapo-ch2-01s.sys.abc.net:1521/test
  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`:
    extension=oci8.so
  9. Restart your HTTP Server and test.
  10. Enjoy

Below links for more reference:

http://pear.php.net/manual/en/installation.getting.php

https://antistatique.net/fr/nous/bloggons/2013/03/25/install-php-oracle-oci-extension-11-2-on-mac-os-x-10-8

http://www.oracle.com/technetwork/articles/dsl/technote-php-instant-084410.html

http://pear.php.net/manual/en/installation.getting.php

https://jason.pureconcepts.net/2012/10/install-pear-pecl-mac-os-x/

This entry was posted in Others and tagged , . Bookmark the permalink.