一、下載Oracle即時客戶端程序包 — Basic: 運行 OCI、OCCI 和 JDBC-OCI 應用程序所需的全部文件
①、打開如下網址(本文以32位版爲例):
(Linux 32位版)http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/linuxsoft.html
(Linux 64位版)http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/linuxx86_64soft.html
②、下載如下幾個文件:php
oracle-instantclient11.1-basic-11.1.0.7.0-1.i386.rpm
oracle-instantclient11.1-devel-11.1.0.7.0-1.i386.rpm
oracle-instantclient11.1-sqlplus-11.1.0.7.0-1.i386.rpm
二、安裝Oracle即時客戶端程序包html
rpm -ivh oracle-instantclient11.1-basic-11.1.0.7.0-1.i386.rpm oracle-instantclient11.1-devel-11.1.0.7.0-1.i386.rpm oracle-instantclient11.1-sqlplus-11.1.0.7.0-1.i386.rpm
echo "/usr/lib/oracle/11.1/client/lib/" > /etc/ld.so.conf.d/oracle_client.conf
/sbin/ldconfig
三、安裝OCI8 PHP擴展(使用PHP自帶的OCI8,假設PHP程序安裝在/usr/local/webserver/php/)linux
yum install libaio
wget
http://pecl.php.net/get/oci8-1.3.5.tgz
tar zxvf oci8-1.3.5.tgz
cd oci8-1.3.5/
/usr/local/webserver/php/bin/phpize
CFLAGS="-I/usr/include/oracle/11.1/client/"
CXXFLAGS="-I/usr/include/oracle/11.1/client/"
./configure --with-php-config=/usr/local/webserver/php/bin/php-config --with-oci8=/usr/lib/oracle/11.1/client/
make
make install
四、修改PHP配置文件(/usr/local/webserver/php/etc/php.ini)
在extension_dir = "/usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-20060613/"後增長一行:web
extension = "oci8.so"
五、重啓PHP
六、建立一個phpinfo.php文件(內容以下)並經過Web訪問,若是有「oci8」這一項,則代表安裝成功。sql
<?php
phpinfo();
?>
![點擊在新窗口中瀏覽此圖片 點擊在新窗口中瀏覽此圖片](http://static.javashuo.com/static/loading.gif)