1.编译安装apache2
./configure --prefix=/usr/local/apache2 --enable-module=so
make clean
make
make install
2.下载oracel客户端安装文件
oracle-instantclient-basic-10.2.0.4-1.i386.rpm
oracle-instantclient-devel-10.2.0.4-1.i386.rpm
oracle-instantclient-sqlplus-10.2.0.4-1.i386.rpm
3.安装及客户端模块加载
rpm -ivh *.rpm
echo "/usr/include/oracle/10.2.0.4/client/" >/etc/ld.so.conf.d/oracle_client.conf
/sbin/ldconfig
4.下载PHP5及编译安装
配置环境变量:
vi /root/.bash_profile
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
export ORACLE_HOME=/opt/taobao/oracle/
export TNS_ADMIN=/home/admin/oracle/network/admin
export LD_LIBRARY_PATH=/opt/taobao/oracle/lib:/usr/local/lib:$LD_LIBRARY_PATH
编译安装:
./configure --with-oci8=/usr/lib/oracle/10.2.0.4/client/ --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --enable-sigchild --with-config-file-path=/usr/local/php/etc/
make
make install
cp php.ini-dist /usr/local/php/etc/
apache2配置项增加:
LoadModule php5_module modules/libphp5.so
AddType application/x-httpd-php .php
5.安装oci8 PHP扩展
下载的 php-5.2.10 里已经有 oci8扩展包了
如果没有,直接去下载个 wget
进到oci8目录 php-5.2.10/ext/oci8
执行php api configure 生成命令:
/usr/local/php/bin/phpize
export CFLAGS="-I /usr/include/oracle/10.2.0.4/client/"
export CXXFLAGS="-I /usr/include/oracle/10.2.0.4/client/"
编译安装:
./configure --with-php-config=/usr/local/php/bin/php-config --with-oci8=/usr/lib/oracle/10.2.0.4/client/
make
make install
6.修改PHP 配置文件
vi /usr/local/php/etc/php.ini
增加两行:
extension_dir = "/usr/local/php/lib/php/extensions/no-debug-zts-20060613"
extension = "oci8.so"
7.重启apache,正常情况下能看到 OCI8有关信息内容,说明已经可以支持oracle客户端。
oci8
OCI8 Support enabled
Version 1.2.5
Revision $Revision: 1.269.2.16.2.44 $
Active Persistent Connections 0
Active Connections 0
Oracle Version 10.1
Compile-time ORACLE_HOME /usr/lib/oracle/10.2.0.4/client/
Libraries Used no value
Temporary Lob support enabled
Collections support enabled
阅读(952) | 评论(0) | 转发(0) |