1、下载Oracle即时客户端程序包 — Basic: 运行 OCI、OCCI 和 JDBC-OCI 应用程序所需的所有文件
- wget http://www.freebsdsystem.org/nginx_php/oracle-instantclient11.2-basic-11.2.0.2.0.x86_64.rpm
- wget http://www.freebsdsystem.org/nginx_php/oracle-instantclient11.2-devel-11.2.0.2.0.x86_64.rpm
- wget http://www.freebsdsystem.org/nginx_php/oracle-instantclient11.2-sqlplus-11.2.0.2.0.x86_64.rpm
2、安装Oracle即时客户端程序包
- rpm -ivh oracle-instantclient11.2-*
- echo "/usr/lib/oracle/11.2/client64/lib/" > /etc/ld.so.conf.d/oracle_client.conf
- /sbin/ldconfig
3、安装OCI8 PHP扩展(使用PHP自带的OCI8,假设PHP程序安装在/usr/local/php52/)
- yum install libaio
- wget http://pecl.php.net/get/oci8-1.4.5.tgz
- tar zxvf oci8-1.4.5.tgz
- cd oci8-1.4.5/
- /usr/local/php52/bin/phpize
- CFLAGS="-I/usr/include/oracle/11.2/client64/"
- CXXFLAGS="-I/usr/include/oracle/11.2/client64/"
- ./configure --with-php-config=/usr/local/php52/bin/php-config --with-oci8=instantclient,/usr/lib/oracle/11.2/client64/lib
- make
- make install
4、修改PHP配置文件(/usr/local/php52/etc/php.ini)
在extension_dir = "/usr/local/php52/lib/php/extensions/no-debug-non-zts-20060613/"后增加一行:
extension = "oci8.so"
5、重启php-fpm
/usr/local/php52/sbin/php-fpm reload