I already have PHP 7.4.11 and Apache 2.4.46 installed on my Mac via Homebrew.
Then installed Oracle instant client & sqlplus (v19.3.0.0.0):
$ brew tap InstantClientTap/instantclient
$ brew install instantclient-basic
$ brew install instantclient-sqlplus
Next is to install the OCI8 extension, by running:
pecl install oci8
PECL prompted me this:
Please provide the path to the ORACLE_HOME directory. Use 'instantclient,/path/to/instant/client/lib' if you're compiling with Oracle Instant Client [autodetect] :
I was not sure what is this /path/to/instant/client/lib
, so I ran locate sqplus
:
/usr/local/Cellar/instantclient-sqlplus /usr/local/Cellar/instantclient-sqlplus/19.3.0.0.0dbru /usr/local/Cellar/instantclient-sqlplus/19.3.0.0.0dbru/.brew /usr/local/Cellar/instantclient-sqlplus/19.3.0.0.0dbru/.brew/instantclient-sqlplus.rb /usr/local/Cellar/instantclient-sqlplus/19.3.0.0.0dbru/INSTALL_RECEIPT.json /usr/local/Cellar/instantclient-sqlplus/19.3.0.0.0dbru/bin /usr/local/Cellar/instantclient-sqlplus/19.3.0.0.0dbru/bin/sqlplus /usr/local/Cellar/instantclient-sqlplus/19.3.0.0.0dbru/lib /usr/local/Cellar/instantclient-sqlplus/19.3.0.0.0dbru/lib/libsqlplus.dylib /usr/local/Cellar/instantclient-sqlplus/19.3.0.0.0dbru/lib/libsqlplusic.dylib /usr/local/Cellar/instantclient-sqlplus/19.3.0.0.0dbru/libexec /usr/local/Cellar/instantclient-sqlplus/19.3.0.0.0dbru/libexec/sqlplus /usr/local/Homebrew/Library/Taps/instantclienttap/homebrew-instantclient/Formula/instantclient-sqlplus.rb /usr/local/bin/sqlplus /usr/local/lib/libsqlplus.dylib /usr/local/lib/libsqlplusic.dylib /usr/local/opt/instantclient-sqlplus /usr/local/var/homebrew/linked/instantclient-sqlplus
OK, let's try these 2 directories:
/usr/local/Cellar/instantclient-sqlplus/19.3.0.0.0dbru/lib
checking Oracle ORACLE_HOME install directory... /usr/local/Cellar/instantclient-sqlplus/19.3.0.0.0dbru/lib checking ORACLE_HOME library validity... configure: error: Oracle library directory not found in /usr/local/Cellar/instantclient-sqlplus/19.3.0.0.0dbru/lib ERROR: `/private/tmp/pear/temp/oci8/configure --with-php-config=/usr/local/opt/php/bin/php-config --with-oci8=/usr/local/Cellar/instantclient-sqlplus/19.3.0.0.0dbru/lib' failed
/usr/local/lib/
checking Oracle Instant Client directory... /usr/local/lib/ checking Oracle Instant Client SDK header directory... configure: error: Oracle Instant Client SDK header files not found ERROR: `/private/tmp/pear/temp/oci8/configure --with-php-config=/usr/local/opt/php/bin/php-config --with-oci8=instantclient,/usr/local/lib/' failed
/path/to/instant/client/lib produced the same error like the former.
What's the correct one, then?
Personally I'd install the new Instant Client 19.8 DMGs from Oracle. The download page and the packages contain instructions. Also see the steps at Notarized macOS Oracle Instant Client Packages Make Installation Easier. Install the Basic and SDK packages - and maybe SQL*Plus if you want that too. The path you would give at the PECL prompt will be /Users/yourname/Downloads/instanclient_19_8 but you can move that directory if you want to put it somewhere else.
It could be that the brew packages are putting the header files in a place that the OCI8 install script isn't aware. By using the DMGs, the headers will be found.