title: How to install OCI8 extension on PHP 7.4 on macOS Catalina or Big Sur?
body: <p>I already have PHP 7.4.11 and Apache 2.4.46 installed on my Mac via Homebrew.</p>
  <p>Then installed Oracle instant client &amp; sqlplus (v19.3.0.0.0):</p>
  <pre><code>$ brew tap InstantClientTap/instantclient
  $ brew install instantclient-basic
  $ brew install instantclient-sqlplus
  </code></pre>
  <p>Next is to install the OCI8 extension, by running:</p>
  <pre><code>pecl install oci8
  </code></pre>
  <p>PECL prompted me this:</p>
  <blockquote>
  <p>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] :</p>
  </blockquote>
  <p>I was not sure what is this <code>/path/to/instant/client/lib</code>, so I ran <code>locate sqplus</code>:</p>
  <blockquote>
  <p>/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</p>
  </blockquote>
  <p>OK, let's try these 2 directories:</p>
  <p><strong>/usr/local/Cellar/instantclient-sqlplus/19.3.0.0.0dbru/lib</strong></p>
  <blockquote>
  <p>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</p>
  </blockquote>
  <p><strong>/usr/local/lib/</strong></p>
  <blockquote>
  <p>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</p>
  </blockquote>
  <p><strong>/path/to/instant/client/lib</strong> produced the same error like the former.</p>
  <p>What's the correct one, then?</p>