Skip to content

Instantly share code, notes, and snippets.

@syahzul
Last active December 4, 2025 11:33
Show Gist options
  • Select an option

  • Save syahzul/f88680d3ada2ff0337013947a9029e33 to your computer and use it in GitHub Desktop.

Select an option

Save syahzul/f88680d3ada2ff0337013947a9029e33 to your computer and use it in GitHub Desktop.
How To Install OCI8 on Ubuntu 24.04 with PHP 8.3

How To Install OCI8 on Ubuntu 24.04 with PHP 8.3

This tutorial is for Ubuntu Server 24.04 with PHP 8.3.

I've compile all the steps into an installer, check it here https://github.com/syahzul/oci-installer-ubuntu

Preparation

Install required dependencies.

sudo apt update
sudo apt install -y libaio1t64 unzip php8.3-dev

Create a symlink for libaio (Ubuntu 24.04 uses libaio.so.1t64 but Oracle Instant Client looks for libaio.so.1).

sudo ln -s /usr/lib/x86_64-linux-gnu/libaio.so.1t64 /usr/lib/x86_64-linux-gnu/libaio.so.1

Step 1

Visit Oracle Instant Client website and download the following files:

Step 2

Create a new folder to store Oracle Instant Client zip files on your server.

sudo mkdir /opt/oracle

Upload the downloaded files to this folder. Now we need to extract the files.

cd /opt/oracle

unzip instantclient-basic-linux.x64-23.26.0.0.0.zip
unzip instantclient-sdk-linux.x64-23.26.0.0.0.zip

Step 3

Add the folder to our ldconfig.

sudo -s
echo /opt/oracle/instantclient_23_26 > /etc/ld.so.conf.d/oracle-instantclient.conf

Run the command below to update the Dynamic Linker Run-Time Bindings

ldconfig

Step 4

Install OCI8 using PECL.

echo instantclient,/opt/oracle/instantclient_23_26 | sudo pecl install oci8

Step 5

Enable the OCI8 extension by creating an ini file for PHP 8.3.

echo "extension=oci8.so" | sudo tee /etc/php/8.3/mods-available/oci8.ini
sudo phpenmod -v 8.3 oci8

Restart PHP-FPM service.

sudo systemctl restart php8.3-fpm.service

Test

From your Terminal, check if the module is loaded:

php -i | grep 'oci8'

If it returns oci8, it works!

Or, create a PHP file and add the code below:

<?php

if (function_exists('oci_connect')) {
    echo 'OCI8 is working!';
}
else {
    echo 'Whoopss...not working!';
}

Test it on your web browser.

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment