How to Install Oracle Instant Client and PHP OCI8 module
First download the oracle instant client basic and devel files from oracle website : http://www.oracle.com/technetwork/topics/linuxsoft-082809.html
oracle-instantclient11.2-basic-11.2.0.3.0-1.i386.rpm and
oracle-instantclient11.2-devel-11.2.0.3.0-1.i386.rpm
from the oracle website and install them:
# rpm -ivh oracle-instantclient11.2-basic-11.2.0.3.0-1.i386.rpm # rpm -ivh oracle-instantclient11.2-devel-11.2.0.3.0-1.i386.rpm
Installing OCI8 from PECL
The OCI8 extension can be added to an existing PHP installation either automatically or manually from » http://pecl.php.net/. Information for installing this PECL extension may be found in the manual chapter titled Installation of PECL extensions. Additional information such as new releases, downloads, source files, maintainer information, and a CHANGELOG, can be located here: » http://pecl.php.net/package/oci8.
For an automated install follow these steps:
If you are behind a firewall, set PEAR’s proxy, for example:
-
pear config-set http_proxy http://my-proxy.example.com:80/
- Run
pecl install oci8
When prompted, enter either the value of $ORACLE_HOME, or instantclient,/path/to/instant/client/lib.
Note: Do not enter the variable $ORACLE_HOME because it will not be expanded. Instead, enter the actual path of the Oracle home directory.
For a manual install, download the PECL OCI8 package, e.g. oci8-1.3.5.tgz.
- Extract the package:
tar -zxf oci8-1.3.5.tgz cd oci8-1.3.5
- Prepare the package:
phpize
- Configure the package, either using $ORACLE_HOMEor Instant Client
./configure -with-oci8=shared,$ORACLE_HOME
or
./configure –with-oci8=shared,instantclient,/usr/lib/oracle/11.2/client/lib/
-
if you get this error: checking Oracle Instant Client SDK header directory… configure: error: Oracle Instant Client SDK header files not found it means your oracle devel package didnt install correctly.
then run
- Install the package:
make install
After either an automatic or manual install, edit your php.ini file and add the line:
extension=oci8.so
If you are having issues using oci_pconnect (causing apache segmentation faults) then you will need to use –with-oci8=shared,instantclient,/usr/lib/oracle/11.2/client/lib and install the 1.3.0 version of the OCI client from http://pecl.php.net/package/oci8


















