安装oracle-oci RPM

    # rpm -ivh oracle-instantclient11.2-basic-11.2.0.1.0-1.i386.rpm
    # rpm -ivh oracle-instantclient11.2-devel-11.2.0.1.0-1.i386.rpm

安装oci8源码包

    # tar zxf oci8.4.1.tar.gz

    # cd oci8-1.4.1

    # /opt/php/bin/phpize

   # ./configure -with-oci8=shared,instantclient,/usr/lib/oracle/11.2/client/lib --with-php-config=/opt/php/bin/php-config

    # make && make install

添加oci8php.ini文件里

# sed -ri 's/extension_dir.*//g' /opt/php/etc/php.ini

# echo -e "extension_dir = /opt/php/lib/php/extensions/no-debug-non-zts-20060613/ \nextension=oci8.so" >> /opt/php/etc/php.ini

编辑php-fpm配置文件,找到<value name="environment">,增加以内容,传递环境变量

    <value name="LD_LIBRARY_PATH">/usr/lib/oracle/11.2/client/lib:${LD_LIBRARY_PATH}</value>
    <value name="TNS_ADMIN">/opt/php/etc</value>
    <value name="NLS_LANG">SIMPLIFIED CHINESE_CHINA.AL32UTF8</value>

nginx 启动

#!/bin/sh
export LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client/lib:${LD_LIBRARY_PATH}
export TNS_ADMIN=/opt/php/etc
export NLS_LANG="SIMPLIFIED CHINESE_CHINA.AL32UTF8"

echo "Starting NginX"
ulimit -SHn 51200
/opt/nginx/sbin/nginx