This procedure is tested on Mac OS Ventura | version 13.6.4
PHP 8.2 installed with Homebrew.
Download the following files from Oracle website (yes, you need to create an account and accept terms):
- In Finder, double click on all desired Instant Client .dmg packages to mount them. All installations require the Basic or Basic Light package.
Create and unzip all theses files into a the directory /usr/local/instantclient/19.16/
.
sudo ln -sfn /opt/oracle/instantclient_19.16/sdk/include/*.h /usr/local/include/
sudo ln -sfn /opt/oracle/instantclient_19.16/*.dylib /usr/local/lib/
sudo ln -sfn /opt/oracle/instantclient_19.16/*.dylib.19.1 /usr/local/lib/
sudo ln -sfn /usr/local/lib/libclntsh.dylib.19.1 /usr/local/lib/libclntsh.dylib
pecl install oci8
If the script prompt you to provide the path to ORACLE_HOME directory, respond with:
instantclient,/opt/oracle/instantclient_19.16
On success installation, you will have messages like the following:
Build process completed successfully
Installing '/usr/local/Cellar/php@8.2/8.2.18/pecl/20220829/oci8.so'
install ok: channel://pecl.php.net/oci8-3.3.0
Extension oci8 enabled in php.ini
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
:
Run
php --ini
to check yourphp.ini
file location.
extension=oci8.so
if you using laravel herd add the extension on php.ini
file.
php.ini location in laravel herd : /Users/kocek/Library/Application Support/Herd/config/php/82
add OCI ext on php.ini file
extension=/usr/local/Cellar/php@8.2/8.2.18/pecl/20220829/oci8.so
Then you should see no more error message when runninng php -v
.
Restart your HTTP Server and test.
Enjoy (or try to...) !