·1 min de lecture

Install PHP Oracle OCI Extension (11.2) on Mac OS X (10.8)

Auteur(s) de l'article

Gilles

Installation

This procedure is tested on Mac OS X 10.8 with Developpers tools installed (xCode).
WARNING: Some users in comment reported issue with more recent version of MacOS.
PHP 5.4 installed with Homebrew.

Preparation

Download the following files from Oracle website (yes, you need to create an account and accept terms):
Create and unzip all theses files into a the directory `/usr/local/instantclient/11.2.0.3/`.
This directory will looks like:

.
├── BASIC_README
├── SQLPLUS_README
├── adrci
├── genezi
├── glogin.sql
├── libclntsh.dylib.11.1
├── libnnz11.dylib
├── libocci.dylib.11.1
├── libociei.dylib
├── libocijdbc11.dylib
├── libsqlplus.dylib
├── libsqlplusic.dylib
├── ojdbc5.jar
├── ojdbc6.jar
├── sdk
│   ├── SDK_README
│   ├── demo
│   ├── include
│   ├── ott
│   └── ottclasses.zip
├── sqlplus
├── uidrvci
└── xstreams.jar

Create symlinks


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

Test with sqlplus instantclient

I recommand to install Oracle Server with a VirtualBox VM preinstalled.

/usr/local/bin/sqlplus oracle/oracle@192.168.2.2

Install extension with pecl


pecl install oci8
If the script prompt you to provide the path to ORACLE_HOME directory, respond with:

instantclient,/usr/local/lib
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
Restart your HTTP Server and test.
Enjoy (or try to…) !
Feel free to fork and adapt this gist !

Partager

Mise à jour le: 12 décembre 2020

Nous serions ravis de discuter avec vous

Nous contacter
Nous contacter

Lausanne

Rue de Genève 90b

+41 21 623 63 03

Newsletter

Formulaire d'inscription à la newsletter

Copyright © 2020 Antistatique

  • Projets
  • Services
  • Agence
  • Équipe
  • Blog
  • Contact

Always keep it simple & sunny!