Based on this manual on PHP web site you should use pecl
.
Run this command:
pecl install oci8
Edit your php.ini
file and add the line:
extension=oci8.so
In case of problem follow this answer:
For anyone stumbling upon this question, here is the proper way to handle it in Linux. (I am using CentOS commands for the demo below but Ubnutu shouldn't be any different)
Step 1: Get the Oracle libs.
EDIT: Thanks to Christopher Jones for the comment, you can find the direct RPM links at https://yum.oracle.com/repo/OracleLinux/OL7/oracle/instantclient/x86_64/
wget oracle-instantclient18.3-basic-18.3.0.0.0-1.x86_64.rpm
wget oracle-instantclient18.3-devel-18.3.0.0.0-1.x86_64.rpm
Step 2: Install.
yum install oracle-instantclient18.3-basic-18.3.0.0.0-1.x86_64.rpm
yum install oracle-instantclient18.3-devel-18.3.0.0.0-1.x86_64.rpm
Step 3: configure (make the path of the oracle libs to be discoverable)
sudo sh -c "echo /usr/lib/oracle/18.3/client64/lib > /etc/ld.so.conf.d/oracle.conf"
sudo ldconfig