PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, December 5, 2022

[FIXED] How to install OCI8 extension on PHP 7.4 on macOS Catalina or Big Sur?

 December 05, 2022     macos-catalina, oci8, oracle, php     No comments   

Issue

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?


Solution

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.



Answered By - Christopher Jones
Answer Checked By - Terry (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing