Skip to content

Instantly share code, notes, and snippets.

@pedropapa
Last active May 26, 2017 14:14
Show Gist options
  • Save pedropapa/6ccde75a1069546a1d0beeef65144afa to your computer and use it in GitHub Desktop.
Save pedropapa/6ccde75a1069546a1d0beeef65144afa to your computer and use it in GitHub Desktop.
Installing oracle's instantclient 12.1c and php (installed via brew) oci8 driver OS X
Prerequisites:
1. PECL installed: https://jason.pureconcepts.net/2012/10/install-pear-pecl-mac-os-x/
PHP 5.6
1. Go to http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html
2. Click "Instant Client for Mac OS X (Intel x86) (32-bit and 64-bit)"
3. Download instantclient-basic-macos.*
4. Download instantclient-sqlplus-macos.*
5. Download instantclient-sdk-macos.*
6. Extract all packages.
7. Move all packages to /Library/Oracle.
7.1 mv ~/Downloads/instantclient-* /Library/Oracle/
8. Move extracted instantclient-sdk/sdk folder to inside instantclient-basic folder.
9. Install oci8 from pecl
9.1 sudo pecl install oci8-2.0.12
9.1.1 When prompted to select ORACLE_HOME directory, put this: instantclient,/Library/Oracle/instantclient_12_1
9.2 When the installation finishes, get the library installation path, it's displayed in the last lines of the oci8 installation, example:
Build process completed successfully
Installing '/usr/lib/php/extensions/no-debug-non-zts-20131226/oci8.so'
10. Get your php.ini file: php -i | grep "Loaded Configuration File"
11. Uncomment or add the following line: extension=oci8.so
12. Restart apache
12.1 You'll most likely get an error saying that you library could not be loaded, get the path that php is trying to load oci8 from and the path returned from step 9.2 and create a symbolic link:
12.1.1 ln -s /usr/lib/php/extensions/no-debug-non-zts-20131226/oci8.so /usr/local/Cellar/php56/your_php_version/lib/php/extensions/no-debug-non-zts-20131226
    12.1.1.1 If this command also fails, create the directory manually:
mkdir /usr/local/Cellar/php56/your_php_version/lib/php/extensions
mkdir /usr/local/Cellar/php56/your_php_version/lib/php/extensions/no-debug-non-zts-20131226
12.1.1.2 Try step 12.1.1 again.
You are done!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment