Ubuntu下安装支持Oracle的PHP扩展

Install Oracle Instant Client

Download Oracle Instant Client packages

First, select right client for your OS here(http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html),
Instant Client for Linux x86-64(http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html) in my case for my 64-bit Ubuntu 14.04.
Then Accept License Agreement and download basic & devel rpm packages for your Oracle version.
Our Oracle DB version is 11g r2, so I need to download:

oracle-instantclient11.2-basic-11.2.0.1.0-1.x86_64.rpm
oracle-instantclient11.2-devel-11.2.0.1.0-1.x86_64.rpm

Install the instant client

Convert .rpm to Debian software package (.deb) using alien:

sudo apt-get install alien
sudo alien -d oracle-instantclient11.2-basic-11.2.0.1.0-1.x86_64.rpm
sudo alien -d oracle-instantclient11.2-devel-11.2.0.1.0-1.x86_64.rpm

This will output oracle-instantclient11.2-basic-11.2.0.1.0-2.x86_64.deb & oracle-instantclient11.2-devel-11.2.0.1.0-2.x86_64.deb which can be installed via Ubuntu’s dpkg command:

sudo dpkg -i oracle-instantclient11.2-basic_11.2.0.1.0-2_amd64.deb
sudo dpkg -i oracle-instantclient11.2-devel_11.2.0.1.0-2_amd64.deb

After successful installation, client library with be installed in /usr/share/oracle/11.2/client64, and developer header files with be in /usr/include/oracle/11.2/client64.

Continue reading “Ubuntu下安装支持Oracle的PHP扩展”