Skip to content

Instantly share code, notes, and snippets.

@udovicic
Created December 27, 2021 09:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save udovicic/b13dbbc64a8bcb7fb21e8aff1edc7f47 to your computer and use it in GitHub Desktop.
Save udovicic/b13dbbc64a8bcb7fb21e8aff1edc7f47 to your computer and use it in GitHub Desktop.
OCI8 installation on ubuntu Ubuntu 18.04.5 LTS running PHP 7.4 from ondrej PPA
#!/bin/bash
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
# Download the Oracle Instant Client and SDK from Oracle website
mkdir /opt/oracle
cd /opt/oracle/
wget https://download.oracle.com/otn_software/linux/instantclient/214000/instantclient-basiclite-linux.x64-21.4.0.0.0dbru.zip
wget https://download.oracle.com/otn_software/linux/instantclient/214000/instantclient-sdk-linux.x64-21.4.0.0.0dbru.zip
unzip instantclient-basiclite-linux.x64-21.4.0.0.0dbru.zip
unzip instantclient-sdk-linux.x64-21.4.0.0.0dbru.zip
echo /opt/oracle/instantclient_21_4 > /etc/ld.so.conf.d/oracle-instantclient.conf
ldconfig
# PECL and compile
apt update
apt install -y php7.4-dev php-pear
pecl channel-update pecl.php.net
# Install oci8 from pecl
clear
echo -e "When prompted, input: instantclient,/opt/oracle/instantclient_21_4\n\n\n"
pecl install oci8-2.2.0
echo "extension =oci8.so" > /etc/php/7.4/cli/conf.d/20-oci8.ini
echo "extension =oci8.so" > /etc/php/7.4/fpm/conf.d/20-oci8.ini
service php7.4-fpm restart
echo -e "\nDONE!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment