This tutorial will guide you on how to install OCI8 for PHP8.3 using Oracle Instant Client arm64.
Run the command below if you haven't installed it on your machine.
xcode-select --installRun the following command to start installing Homebrew.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"Verify your brew installation using the command below:
which brewYou should get /opt/homebrew/bin/brew as the output.
Warning
If you got notice brew not found, you need to add /opt/homebrew/bin to your environment path.
Simply add export PATH="/opt/homebrew/bin:$PATH" to your .zshrc file.
Download the following files from Oracle Instant Client Downloads for macOS (arm64)
Create a folder for the files.
sudo mkdir -p /opt/oracle/instantclient_23_3Now, extract both .dmg files and move the contents to /opt/oracle/instantclient_23_3.
Wen can proceed to install the latest version of PHP (which is 8.3 at the moment) and the dependencies. It may take a while to complete.
brew install phpVerify the PHP version installed on our machine.
php -v
PHP 8.3.8 (cli) (built: Jun 4 2024 14:53:17) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.8, Copyright (c) Zend Technologies
with Zend OPcache v8.3.8, Copyright (c), by Zend TechnologiesInstall the latest version of oci8 (v3.3.0) with PECL.
echo instantclient,/opt/oracle/instantclient_23_3 | pecl install oci8Warning
If you ever got an error command not found: pecl, make sure PHP bin folder is included in your environment path.
Note
Use the appropriate version of oci8 for your PHP. Refer https://pecl.php.net/package/oci8 for more info.
By default, macOS will block the Instant Client files since the developer cannot be verified. We have to allow it one by one.
Open your System Settings > Privacy & Security > Security, and keep it open, don't close it.
Run the command below to trigger the warning.
php -mmacOS will pop up the warning dialog, click on Open (if available) or Cancel, and click Allow Anyway on your Privacy & Security window. You might have to do it a few times until no more warning dialog appears.
Run the command to make sure oci8 is enabled.
php -m | grep oci8Create a file containing the following codes.
<?php
if (function_exists('oci_connect')) {
echo 'OCI8 is working!';
} else {
echo 'Whoopss...not working!';
}
when run

echo instantclient,/opt/oracle/instantclient_23_3 | pecl install oci8, got