日期:2014-05-16  浏览次数:20634 次

linux下php安装oracle客户端 oci8

主要参考http://blog.s135.com/post/411/这篇文章,但是遇到了一些问题。这里记录一下



1、下载Oracle即时客户端程序包 — Basic: 运行 OCI、OCCI 和 JDBC-OCI 应用程序所需的所有文件

  ①、打开以下网址(本文以32位版为例):
  http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html

  ②、下载以下几个文件:

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


  2、安装Oracle即时客户端程序包
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


  3、安装OCI8 PHP扩展(使用PHP自带的OCI8,假设PHP程序安装在/usr/local/webserver/php/)
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
这里如果出错,就是用
./configure --with-php-config=/usr/local/webserver/php/bin/php-config --with-oci8=instantclient,/usr/lib/oracle/11.1/client/lib/
make install