How to Install Oracle Driver for PHP on Ubuntu 18.04

How to Install Oracle Driver for Ubuntu 18.04

Oracle Database, or more commonly referred to only as Oracle, is a Relational Database Management System (RDBMS) type, which is a proprietary database from Oracle Corporation. The PHP programming language can use Oracle, but by default PHP on Ubuntu 18.04 is not yet available for Oracle driver, so you have to install it manually.

0. Requirements

Ubuntu 18.04 must be installed using Apache and PHP (7.2).

1.Install Oracle Driver

Download Oracle instantclient here. Then upload to the server.

  1. instantclient-basic-linux.x64-12.2.0.1.0.zip
  2. instantclient-sdk-linux.x64-12.2.0.1.0.zip

Extract files that have been uploaded on the server.

Create oracle folder.

Move and rename the instantclient folder.

Change folder ownership.

Install dependencies needed to install OCI8 (Oracle Instant Client 8).

Make a symbolic link.

Add an instant client to ldconfig.

Update Dynamic Linker Run-Time Bindings

Install oci8.

Showing questions

Answer with

Add OCI8 to cli php config.

Add OCI8 to Apache PHP Config.

Set environement variables for cli (The server must be restarted)

Set environement variables for apache.

Restart apache

2.Testing

Create info.php file.

Browse http://IP-SERVER/info.php, find oci8.

PHP Info - oci8
PHP Info – oci8

Leave a Reply

Your email address will not be published. Required fields are marked *