This guide refers to Instantclient Version 12.2.0.1.0
Download the latest Oracle Instant Client and SDK from the Oracle website (Yeah, fuck you Oracle, you need to create an account to download the files).
http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html
Look for instantclient-basic-linux.x64-12.2.0.1.0.zip
and instantclient-sdk-linux.x64-12.2.0.1.0.zip
.
Create a new folder to store the Oracle Instant Client files on your machine.
mkdir /opt/oracle
And move your files to /opt/oracle
.
Extract the files
cd /opt/oracle
unzip instantclient-basic-linux.x64-12.2.0.1.0.zip
unzip instantclient-sdk-linux.x64-12.2.0.1.0.zip
Next, we need to symlink the .so
files.
ln -s /opt/oracle/instantclient_12_2/libclntsh.so.12.2 /opt/oracle/instantclient_12_2/libclntsh.so
ln -s /opt/oracle/instantclient_12_2/libocci.so.12.2 /opt/oracle/instantclient_12_2/libocci.so
Now lets add the folder to the ldconfig's config folder.
echo /opt/oracle/instantclient_12_2 > /etc/ld.so.conf.d/oracle-instantclient.conf
And update the dynamic linker runtime bindings.
ldconfig
Great! We're almost there!
To install the OCI8 extension, we need to get some additional packages.
Run these commands to install the necessary packages:
apt install php-dev php-pear build-essential libaio1
Install the oci8 extension via PECL.
echo "instantclient,/opt/oracle/instantclient_12_2" | pecl install oci8
We now can tell PHP to load the OCI8 extension.
echo "extension=oci8.so" >> /etc/php/7.1/mods-available/oci8.ini
ln -s /etc/php/7.1/mods-available/oci8.ini /etc/php/7.1/cli/conf.d/20-oci8.ini
ln -s /etc/php/7.1/mods-available/oci8.ini /etc/php/7.1/fpm/conf.d/20-oci8.ini
Check if the extension is enabled.
php -m | grep oci8
php-fpm7.1 -m | grep oci8
If you see oci8
, you're almost done!
Restart PHP-FPM.
service php7.1-fpm restart
Finished! Well done! Thanks for pulling through with this tedious procedure!
@mazedlx - Thanks for the suggestion. Not sure what you mean that my OCI8 wasn't compiled for PHP 7.3. After some googling and thinking I decided to perform a
I followed any prompts that came up. After the uninstall I started back over with the above tutorial at Step 2. Followed everything in the tutorial for my 18_3 install version and it worked. Thanks for your help.