Tag Archives: oracle

How To Enable OCI8 on PHP 5.4 and Install Oracle Instant Client on Mac OS X 10.9 Maverick

After upgrading to OS X 10.9 Maverick, i’ve to reinstall PHP library and reconfigure it. Oracle OCI8 is one of PHP libraries which need to be reconfigured.

Today i spend more than 2 hours just to find out how to enable Oracle OCI8 in PHP 5.4.24. So I post it here just in case i have to reconfigure it again, i don’t have to feel the pain again.

Lets Start!

  1. Download Oracle Client Library from http://www.oracle.com/technetwork/topics/intel-macsoft-096467.html
    You have to download 3 files:

    After downloading 3 files above, you have to extract instantclient-basic and instantclient-plus zip files into one folder, for example in “/Applications/instantclient”. And then create folder named “sdk” inside that folder, and extract instantclient-sdk into it.  And then add symbolic link using this command in Terminal:

    ln -s libclntsh.dylib.11.1 libclntsh.dylib

    Oracle Instant Client folder

    Oracle Instant Client folder (click picture to enlarge).

  2. Download oci8 tar PECL package from http://pecl.php.net/package/oci8
    After downloading package from pecl, extract it anywhere you like. And then open “Terminal” and go to that folder. Then run commands below.

    phpize
    ./configure --with-oci8=shared,instantclient,/Applications/instantclient
    make
    sudo make install

    Edit “/Applications/instantclient/” to the path where you extract Oracle Instant Client (point 1).

  3. Edit Apache plist file on /System/Library/LaunchDaemons/org.apache.httpd.plist
    Open Apache plist using text editor and then find Environment Key section. Add DYLD_LIBRARY_PATH key and your Oracle Instant Client folder as value.

    Editing Apache plist File

    Editing Apache plist File

  4. Open your /Users/yourusername/.bash_profile file using text editor, then add “export DYLD_LIBRARY_PATH=/Applications/instantclient/” (without quotes) at the end of file.
  5. Edit your php.ini and add “extension=oci8.so”
  6. Open terminal, and run this command : sudo apachectl restart
  7. Done! Open PHP Info

    oci8 has been installed

    oci8 has been installed

UPDATE:

If you still not getting it to work, check Sarah’s comment below.