How to install oracle instantclient and pdo_oci on ubuntu machine?

instantclient, oracle, pdo, php, ubuntu

Solution

The PDO, PDO_OCI extensions from `pecl install` are obsolete because latest PHP version has them built-in its core & installation these extensions by this way mostly failed.

I've spent a lot of time to try to do this following several approach with no luck, and finally find it out by myself a clean way to do this: compile & install the extensions from PHP source.

During the compilation, there are some tricks as well, I've described the process in detail in my post: https://medium.com/@thucnc/how-to-install-php5-pdo-oci-oci8-and-other-extensions-for-ubuntu-f405eadfe784

Short steps are listed here:

- Download & install Oracle instant Client, then export `ORACLE_HOME` environment variable

Download & compile PDO_OCI (and OCI8 if needed) form PHP source packages, there are some tricks that you need to applied here, including:

`sudo ln -s /usr/include/php5/ /usr/include/php`

and edit the Makefile:

`EXTRA_INCLUDES = -I/usr/include/oracle/11.2/client64`

Enable the extensions and restart web server

This has been tested for Debian 7.6 as well

Hope this helps.

Problem

I need to install PDO_OCI in ubuntu machine, there is no default package that I could install with apt-get. There are a lot of tutorials showing how to do it, but when I follow them, I have problems related to compilation (configure, make,...) Here what I did: I followed this Tutorial to install instant client Install oci8 ``` pecl install oci8 ``` I get error: error: oci.h not found Install PDO_OCI ``` mkdir -p /tmp/pear/download/ cd /tmp/pear/download/ pecl download pdo_oci phpize ./configure –with-pdo-oci=instantclient,/usr,11.2 ``` error: pdo_driver.h not found ... Please do you have any serious tutorial that works perfectly on UBUNTU 12.04?

Original source

Related problems