Automated installation script for OCI8 extension on Ubuntu 24.04 with PHP 8.2-8.5.
This installer script is based on the tutorial from: https://gist.github.com/syahzul/f88680d3ada2ff0337013947a9029e33
Run the installer script with sudo:
wget -O oci8-installer.sh "https://raw.githubusercontent.com/syahzul/oci-installer-ubuntu/refs/heads/main/install.sh"; bash oci8-installer.shThe script will:
- Detect installed PHP versions (8.2-8.5)
- Allow you to select which PHP version to install OCI8 for
- Automatically download and install Oracle Instant Client
- Install and configure OCI8 extension via PECL
- Restart PHP-FPM service if available
- Ubuntu 24.04
- PHP 8.2, 8.3 or 8.4 installed
- Root or sudo access
- Internet connection (for downloading Oracle Instant Client)
After installation, verify OCI8 is loaded:
php8.3 -m | grep oci8Or test with PHP code:
<?php
if (function_exists('oci_connect')) {
echo 'OCI8 is working!';
} else {
echo 'OCI8 is not working!';
}